akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long n,w;
    cin>>n>>w;
    vector<long long> wt(n);
    vector<long long> val(n);
    int mx=n*1000;
    for(int i=0;i<n;i++)
    {
        cin>> wt[i]>> val[i];

    }

    long long dp[n+1][n*1000 +1];

        for(long long j=1;j<=mx;j++)
        {
            
            dp[0][j]=INT_MAX-100;
        }
    dp[0][0]=0;
    
    int m=INT_MIN;

    for(int i=1;i<=n;i++)
    {
        for( int j=1;j<=mx;j++)
        {
            if(val[i-1]<=j)
            {
                dp[i][j]=min(dp[i-1][j],dp[i-1][j-val[i-1]]+wt[i-1]);
                
            }
            else
            {
                dp[i][j]=dp[i-1][j];
            }
            // cout<<dp[i][j]<<" ";
        }

    }
    for(long long i=mx;i>=0;i--)
    {
         if(dp[n][i]<=w)
       {
            cout<<i;
            return 0;
        }
        
    }
    return 0;
    
}

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

#define ll long long
#define ld long double
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define ii pair < int, int >
#define vi vector < int > 
#define vii vector < pair < int, int > >
#define vvi vector < vector < int > >
#define all(a) (a).begin(), (a).end()

using namespace std;
using namespace __gnu_pbds;

typedef tree< int, null_type, less< int >, rb_tree_tag, tree_order_statistics_node_update> ost;
// name.find_by_order( x ) or name.order_of_key( x )

int grundy( int n, int k ) {
	if ( n < k ) return 0;
	if ( n % k == 0 ) return n / k;
	
	int d = n / k;
	int raz = ceil( (double)( n % k ) / ( d + 1 ) );
	n -= raz * ( d + 1 );
	return grundy( n, k );
}

int main() {
	int n;
	cin >> n;
	int sum = 0;
	for( int i = 0;i < n;i++ ) {
		int x, k;
		cin >> x >> k;
		x = grundy( x, k );
		sum ^= x;
	}
	cout << ( sum ? "Takahashi" : "Aoki" ) << "\n";
	return 0;
}


Measured memory_bytes: 3580
#include<stdio.h>

void sort(int n,int *p){
    int i,j,temp;

    for(i=0;i<n;i++)
        for(j=i;j<n;j++)
            if(p[i]>p[j]){
                temp = p[i];
                p[i] = p[j];
                p[j] = temp;
            }

}

int main(void){
    int n, k;
    int i,sum=0;
    
    scanf("%d %d",&n,&k);

    int p[n];

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

    sort(n,p);

    for(i=0;i<k;i++){
        sum += p[i];
    }

    printf("%d",sum);

    return 0;
}

Measured memory_bytes: 1716
n = int(input())
a1 = input().split(" ")
an = [int(i) for i in a1]

goukei = 0
for i in range((n-1)):
    an01=an[i]-an[i+1]
    if  an01 >= 0:
        an[i+1] = an[i]
        goukei += an01

print(goukei)

Measured memory_bytes: 32108
import java.util.Scanner;
import java.util.Arrays;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int n = scan.nextInt();
			int[] str = new int[n];
			for(int i = 0;i < n;i++){
				str[i] = scan.nextInt();
			}
			Arrays.sort(str);
			int[] a = new int[3];
			int count = 0;
			int t = 0;
			for(int i = 0;i < n/2+1;i++){
				for(int j = 0;j < n && j < 4;j++){
					if(i == j){
						continue;
					}
					t = Integer.parseInt(str[i] + "" + str[j]);
					if(count < 3){
						a[count] = t;
						count++;
					}else{
						if(count == 3){
							Arrays.sort(a);
							count++;
						}
						if(a[2] > t){
							if(a[1] > t){
								a[2] = a[1];
								if(a[0] > t){
									a[1] = a[0];
									a[0] = t;
								}else{
									a[1] = t;
								}
							}else{
								a[2] = t;
							}
						}
					}
				}
			}
			System.out.println(a[2]);
		}
	}
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(const T& value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << '\n';
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

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

  in(int, n);
  out(n < 1000 ? "ABC" : "ABD");
}


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

#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

int main() {

    long long int n, k;
    cin >> n >> k;

    long long int ans = n;
    bool f[114] = {};
    for ( long long int i = 0; i < k; i++ ) {
        long long int d;
        cin >> d;
        for ( long long int j = 0; j < d; j++ ) {
            long long int a;
            cin >> a;
            a--;
            if ( f[a] ) continue;
            f[a] = true;
            ans--;
        }
    }
    cout << ans << endl;

    return 0;

}


Measured memory_bytes: 3596
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<unordered_set>
#include<unordered_map>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod;
#define N 2010
char c[N][N];
ll f[N][N];
int main(){
  ll h,w;cin>>h>>w;
  for(int i=0;i<h;i++)for(int j=0;j<w;j++){
      cin>>c[i][j];
      f[i][j]=0;
  }
  ll cnt;
  for(int i=0;i<h;i++){
      cnt=0;
      for(int j=0;j<w;j++){
	  if(c[i][j]=='#')cnt=0;
	  else{
	      f[i][j]+=cnt;
	      cnt++;
	  }
      }
      cnt=0;
      for(int j=w-1;j>=0;j--){
	  if(c[i][j]=='#')cnt=0;
	  else{
	      f[i][j]+=cnt;
	      cnt++;
	  }
      }
  }
  for(int i=0;i<w;i++){
      cnt=0;
      for(int j=0;j<h;j++){
	  if(c[j][i]=='#')cnt=0;
	  else{
	      f[j][i]+=cnt;
	      cnt++;
	  }
      }
      cnt=0;
      for(int j=h-1;j>=0;j--){
	  if(c[j][i]=='#')cnt=0;
	  else{
	      f[j][i]+=cnt;
	      cnt++;
	  }
      }
  }
  ll ans=0;
  for(int i=0;i<h;i++)for(int j=0;j<w;j++){
      ans=max(ans,f[i][j]);
  }
  cout<<ans+1<<endl;
  return 0;
}


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

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

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  NodePointer  x;
  for(x=nil;x->next!=nil;x=x->next){
  if(x->next->key==key)return x->next;
  }
  return NULL;
}

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

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

 void deleteNode(NodePointer t){
   t->next->prev=t->prev;
   t->prev->next=t->next;
   free(t);
 }

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

void deleteLast(){
 NodePointer x;
  x=nil->prev;
  deleteNode(x);
}

void delete(int key){
  NodePointer x;  
  x=listSearch(key);
  if(x!=NULL)deleteNode(x);
}


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

}

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

  printList();
  return 0;
}



Measured memory_bytes: 32948
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <list>
#include <cmath>
using namespace std;
#define rep(i,m,n) for (int i = (int) (m); i < (int) (n); i++)
#define rep1(i,m,n) for (int i = (int) (m); i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
long long int Max(long long int a,long long int b){
    if(a>=b)return a;
    else return b;
}
long long int comb(long long int n,long long int r){
    vector<vector<long long int> > v(n+1,vector<long long int>(n+1,0));
    long long int i,j;
    rep(i,0,n+1){
        v.at(i).at(0)=1;
        v.at(i).at(i)=1;
    }
    rep(i,0,n+1){
        rep(j,0,i)v.at(i).at(j)=v.at(i-1).at(j-1)+v.at(i-1).at(j);
    }
    return v.at(n).at(r);
}
int main(void){
    int H,A;
    cin>>H>>A;
    if(H%A==0)cout<<H/A<<endl;
    else cout<<H/A+1<<endl;
}

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

#define FAST_IO                       \
	ios_base::sync_with_stdio(false); \
	cin.tie(0);                       \
	cout.tie(0);

#define debug(a) cout << #a << " " << a << endl;
#define _debug(a, i) cout << #a << "[" << i << "]" << " = " << a[i] << endl;

using namespace std;

using ll = long long;

const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;

ll powmod(ll a, ll b) { ll res = 1; a %= MOD; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res * a % MOD; a = a * a % MOD; }return res; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }


int main()
{
	FAST_IO;
	ll n, k;
	cin >> n >> k;
	vector<ll> ans(k + 1);
	for (int i = k; i >= 1; --i) {
		ans[i] = powmod(k / i, n);
		ans[i] %= MOD;
		for (int j = i * 2; j <= k; j += i) {
			ans[i] -= ans[j];
			ans[i] %= MOD;
		}
	}
	ll answer = 0;
	for (ll i = 1; i <= k; i++) {
		answer += ((i % MOD) * (ans[i] % MOD)) % MOD;
		answer %= MOD;
	}
	
	cout << answer;
	return 0;
}


Measured memory_bytes: 3988
def main():
    import sys
    my_input = sys.stdin.readline
    N, Q = map(int, my_input().split())
    A = list(map(int, my_input().split()))

    MAX_A = 5 * 10 ** 5
    query = []
    for q in range(Q):
        l, r = map(int, my_input().split())
        query.append((l, r, q))

    class BinaryIndexedTree:
        def __init__(self, n):
            self.size = n
            self.bit = [0] * (n + 1)

        def sum(self, i):
            s = 0
            while i > 0:
                s += self.bit[i]
                i -= (i & -i)
            return s

        def add(self, i, x):
            while i <= self.size:
                self.bit[i] += x
                i += (i & -i)

        def reset(self):
            self.bit = [0] * (self.size + 1)


    BIT = BinaryIndexedTree(N)
    X = [-1] * (MAX_A + 1)
    for i, a in enumerate(A, start=1):
        X[a] = i
    for x in X:
        if x == -1:
            continue
        BIT.add(x, 1)

    ans = [-1] * Q
    query.sort(key=lambda x: x[1])

    mr = 0
    for l, r, i in query:
        while mr < r:
            mr += 1
            BIT.add(X[A[mr - 1]], -1)
            X[A[mr - 1]] = mr
            BIT.add(mr, 1)
        ans[i] = BIT.sum(r) - BIT.sum(l - 1)

    for a in ans:
        print(a)


if __name__ == '__main__':
    main()


Measured memory_bytes: 182024
# 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>
using namespace std;
typedef long long int ll;
const int N = 1000000;
const int INF = 1 << 30;
#define rep(i,n) for(int i=(ll)0;i<(ll)n;++i)
#define ALL(x) x.begin(),x.end()
string YN(bool b) { return(b ? "YES" : "NO"); }
string yn(bool b) { return(b ? "Yes" : "No"); }
int main() {
	ll n, v[110],a=0,b=0;
	cin >> n;
	rep(i, n)cin >> v[i];
	sort(v, v + n);
	rep(i, n) {
		if (i % 2 == 0)a += v[n-1-i];
		else b += v[n - 1 - i];
	}
	cout << a - b << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
#include <vector>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;
using Field=vector<vector<int>>;

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

const double PI=(acos(-1));

int main(){
    int H,W,h,w;
    cin>>H>>W>>h>>w;
    int ans=H*W-(H*w+W*h)+(h*w);
    cout<<ans<<endl;
}


Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

string divide[4] = {"dream", "dreamer", "erase", "eraser"};

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

    int ans = 0;

    if (((a % 2) == (b % 2)) & ((a % 2) == (c % 2)))
    {
        ans = 0;
    }
    else
    {
        ans++;
        if ((((a + 1) % 2) == ((b + 1) % 2)) &(((a + 1) % 2) == (c % 2)))
        {
            a++;
            b++;
        }
        else if ((((a + 1) % 2) == (b % 2)) & (((a + 1) % 2) == ((c + 1) % 2)))
        {
            a++;
            c++;
        }
        else
        {
            c++;
            b++;
        }
    }
    int MAX = max({a, b, c});
    ans += (3 * MAX - a - b - c) / 2;

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define ull unsigned long long
#define F first
#define S second
#define eps 1e-6
#define mp make_pair
const long long INF=1e18+2;
const int MX=100004;
int N, M, k;
ll arr[MX];
ll dp[12], ways[13];
int main()
{
    string s;
    cin>>s;
    N=s.size();
    for(int i=N-1;i>=0;i--)
    {
        ways[i]=1;
        for(int j=i+1;j<N;j++)
            ways[i]+=ways[j];
   //     cout<<ways[i]<<" ";
    }
    for(int i=N-1;i>=0;i--)
    {
        ll num=s[i]-'0';
        for(int j=i+1;j<N;j++)
        {
          //  cout<<num<<","<<dp[j]<<" ";
            dp[i]+=((num*ways[j]+dp[j]));
            num*=10LL;
            num+=(s[j]-'0');
        }
      ///  cout<<"num "<<num;
        dp[i]+=num;
      ///  cout<<endl;
    }
    cout<<dp[0]<<" ";
    return 0 ;
}


Measured memory_bytes: 256
#ifdef __LOCAL
  #define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b) {if(a<b) {a=b; return true;} return false;}
template<typename T> bool chmin(T &a,T b) {if(a>b) {a=b; return true;} return false;}
#define itn int
#define fi first
#define se second
#define intmax numeric_limits<int>::max()
#define llmax numeric_limits<ll>::max()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>=1;i--)
#define all(vec) vec.begin(),vec.end()
#define sortt(vec) sort((vec).begin(),(vec).end())
#define rsort(vec) sort((vec).rbegin(), (vec).rend())
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=1<<30;
const ll lnf=1ll<<60;

int prevv[100010]; //頂点の最大数
struct edge{int to,cost;};

vector<ll> dijkstra(int n,vector<vector<edge> > G,int sv){
  fill(prevv,prevv+n,-1);
  priority_queue<pll,vector<pll>,greater<pll> > que;
  vector<ll> dist(n,lnf);
  dist[sv]=0;
  que.push(pll(0,sv));
  while(!que.empty()){
    ll cost; int v;
    tie(cost,v)=que.top();
    que.pop();
    if(dist[v]<cost) continue;
    for(int i=0;i<G[v].size();i++){
      edge e=G[v][i];
      ll ec=e.cost;
      int nv=e.to;
      if(dist[nv]>dist[v]+ec){
        dist[nv]=dist[v]+ec;
        prevv[nv]=v;
        que.push(pll(dist[nv],nv));
      }
    }
  }
  return dist;
}

//頂点への最短路
vector<int> get_path(int t){
  vector<int> path(0);
  for(;t!=-1;t=prevv[t]) path.push_back(t);
  reverse(path.begin(),path.end());
  return path;
}

int main(){
  int n,m; cin >> n >> m;
  vector<vector<edge> > to(n);
  vector<vector<int> > rto(n); 
  rep(i,m){
    itn a,b;
    cin >> a >> b;
    a--; b--;
    to[a].push_back({b,1});
    rto[b].push_back(a);
  }
  ll infdist=inf;
  itn thegv=-1;
  itn thesv=-1;
  rep(i,n){
    vector<ll> dist=dijkstra(n,to,i);
    for(auto v:rto[i]){
      if(chmin(infdist,dist[v]+1)){
        thegv=v;
        thesv=i;
      }
    }
  }
  if(thegv!=-1){
    vector<ll> dist=dijkstra(n,to,thesv);
    vector<int> path=get_path(thegv);
    cout << path.size() << endl;
    for(auto v:path){
      cout << v+1 << endl;
    }
    return 0;
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int N;
    cin>>N;
    int ans=0;
    for(int i=1;i*i<=N;i++){
        if(N%i==0){
            int a,b;
            a=i-1;
            b=N/i-1;
            if( a!=0) {
                if(N%a==N/a) ans+=a;
            }
            if(a!=b && (N%b==N/b)) ans+=b;
        }
    }

cout << ans << endl;



}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;

int main(){
	int A, B, C;
	cin >> A >> B >> C;

	if((A==5&&B==5&&C==7)||(A==5&&B==7&&C==5)||(A==7&&B==5&&C==5)) cout << "YES" << endl;
    else cout << "NO" << endl;
	
	
	return 0;
}

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

using namespace std;

int main()
{
   int n;
   cin>>n;
   int i,a[n],j=-1;
   int64_t sum=0;
   for(i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]>j)
            j=a[i];
         sum+=j-a[i];
    }
   cout<<sum<<endl;
}


Measured memory_bytes: 4416
import java.util.InputMismatchException;
import java.util.Scanner;

public class Main{


	public static void main(String[] args){

    	Scanner scan = new Scanner(System.in);

				try{
            int n=scan.nextInt();

            call(n);


				}catch(InputMismatchException e){
					System.out.println("??¨??????:"+e);
				}
        	scan.close();


	}


	public static void call(int n){

		int x;
		for(int i=1;i<n+1;i++){

			if(i%3==0 ||i%10==3){
				System.out.print(" "+i);
			}else if((i/10)>0){
				x=i;
				while(x/10>0){
				x/=10;
				if(x%10==3){
					System.out.print(" "+i);
					break;
				}

				}
			}
			//???????????¶????????????????????????????????????i???10??§???????????¨???
			//i/10>0?????¨???



		}System.out.print('\n');


	}

}

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

int Fibonacci(long long n) {
  int y=1;
  int x=1;
  for (int i=0;i<n-1;i++){
  int p=x%1000000007;
   x=y%1000000007;
    y=(x+p)%1000000007;
  
  }
   return y;
}
int main() {
  long long N;
  long long M;
  cin >>N>>M;
  if (M==0){
    long long c= Fibonacci(N);
    cout <<c <<endl;
  }
  
  else{
  vector<long long>data(M);
  for (long long i=0;i<M;i++){
    cin >>data.at(i);
  }
  long long  p= data.at(0)-1;
  long long s =Fibonacci(p);
  
  for (long long i=0;i<M-1;i++){
   long long e= data.at(i+1)-data.at(i)-2;
   if (e<0){
   s*=0;     
   }
   else {
     s=(s*Fibonacci(e))%1000000007;
   }
  }  
  long long r=N-data.at(M-1)-1;
  s=(s*Fibonacci(r))%1000000007;
  
  s%= 1000000007;
 
  cout << s<<endl;
  }
}


Measured memory_bytes: 1024
n=int(input())
s=[]
for i in range(n):
    s.append(input())
a,b,c,d=0,0,0,0
for i in range(n):
    if s[i]=="AC":
        a+=1
    elif s[i]=="WA":
        b+=1
    elif s[i]=="TLE":
        c+=1
    else:
        d+=1
print("AC x "+str(a))
print("WA x "+str(b))
print("TLE x "+str(c))
print("RE x "+str(d))

Measured memory_bytes: 79068
#include<iostream>
#include<stdio.h>
#include<cmath>
#include<algorithm>
#include<string>
#define INF 9999999
using namespace std;
int ans,n,used[36],t[5][5][4];
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
char pz[36][4];
string str;
void init();
int judge(char,char);
void dfs(int,int);
int main(){
	cin>>n;
	for(int I=0;I<n;I++){
		init();
		for(int i=0;i<9;i++){
			cin>>str;
			for(int j=0;j<4;j++)pz[i*4+0][j-0]=str[j];
			for(int j=1;j<4;j++)
				for(int k=j;k<4+j;k++)
					pz[i*4+j][k-j]=str[k%4];
		}

		ans=0;
		dfs(1,1);
		cout<<ans<<endl;

	}
	return 0;
}
void init(){
	for(int i=0;i<36;i++)used[i]=0;
	for(int i=0;i<5;i++){
		for(int j=0;j<5;j++){
			for(int k=0;k<4;k++){
				t[i][j][k]='0';
			}
		}
	}
}
int judge(char a,char b){
	//cout<<a<<" "<<b<<endl;
	int c = 'A'-'a';
	if(a+c==b||a==b+c||a=='0'||b=='0')return 1;
	else return 0;
}

void dfs(int y,int x){
	//cout<<y<<" "<<x<<endl;
	if(y==4&&x==1){ans++;return;}
	for(int i=0;i<36;i++){
		if(used[i]==1)continue;
		int flg=0,nx,ny;
		//test
		for(int j=0;j<4;j++)t[y][x][j]=pz[i][j];
		for(int j=0;j<4;j++){
			nx=x+dx[j];ny=y+dy[j];
			if(judge(t[ny][nx][(j+2)%4],t[y][x][j]))flg++;
		}
		if(flg==4){

			used[i/4*4]=used[i/4*4+1]=used[i/4*4+2]=used[i/4*4+3]=1;
		
			dfs(y+(x==3),x+1-3*(x+1>3));
		
			used[i/4*4]=used[i/4*4+1]=used[i/4*4+2]=used[i/4*4+3]=0;
		}
		//test end
		for(int j=0;j<4;j++)t[y][x][j]='0';
	}
}

Measured memory_bytes: 1196
import java.util.*;

public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B =  sc.nextInt();
    int C = sc.nextInt();
    int D= A + B + C;
    if(D==3*A){
      System.out.println("Yes");
    }else{
    	System.out.println("No");
    }
  }
}



Measured memory_bytes: 23252
#include <iostream>
#include <iomanip>
#include <cassert>

#include <utility>
#include <vector>
#include <limits>
#include <algorithm>
#include <map>
#include <list>
#include <cmath>
using namespace std;

#define rep_init(i, init, n) for(int i = (init); i < n; ++i)
#define rep(i, n) rep_init(i, 0, n)
void Main()
{
	int A, B;
	int H, M;
	cin >> A >> B >> H >> M;

	double theta1, theta2;
	theta1 = (static_cast<double>(360) / static_cast<double>(12)) * H + (static_cast<double>(360) / static_cast<double>(60 * 12)) * M;
	theta2 = (static_cast<double>(360) / static_cast<double>(60)) * M;

	double out = static_cast<double>(A * A) ;
	out += +static_cast<double>(B * B);
	out -= static_cast<double>(2 * A * B) * cos((theta1 - theta2) * (3.14159265358979323846 / 180));
	out = sqrt(out);

	cout << out << endl;

	return;
}

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

	Main();
	return 0;
}

Measured memory_bytes: 4316
//header{{{
//#define _GLIBCXX_DEBUG
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/math/common_factor_rt.hpp>
  
using namespace std;
//using namespace boost::multiprecision;  
//using namespace boost::math;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int_fast64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

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


signed main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout.setf(ios_base::fixed);
    cout.precision(10);

    int n;
    cin >> n;

    umap<string, int> cnt;

    rep(i,n){
        string s;
        cin >> s;
        ++cnt[s];
    }

    cout << "AC x " << cnt["AC"] << '\n';
    cout << "WA x " << cnt["WA"] << '\n';
    cout << "TLE x " << cnt["TLE"] << '\n';
    cout << "RE x " << cnt["RE"] << '\n';

    return 0;
}


Measured memory_bytes: 3680
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		int a,b;
		Scanner scan = new Scanner(System.in);
		a=scan.nextInt();
		b=scan.nextInt();
		scan.close();
		System.out.println(gcd(a,b));
		
	}
	public static int gcd(int x, int y){
		if(y==0){
			return x;
		}
		else if(x>=y){
			x=gcd(y,x%y);
		}
		else{
			x=gcd(x,y%x);
		}
		return x;
	}
}


Measured memory_bytes: 26224
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

pair<int,int> P[100010];

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

	int N, M;
	cin >> N >> M;

	rep(i, 0, N)
	{
		cin >> P[i].first >> P[i].second;
	}

	sort(P, P + N);

	int ans = 0;
	rep(i, 0, N)
	{
		if (M <= P[i].second)
		{
			ans += M * P[i].first;
			break;
		}
		else
		{
			ans += P[i].first*P[i].second;
			M -= P[i].second;
		}
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))


//辺の情報を個別に持つタイプ
typedef struct edge{ll s,g,c;}E;
typedef struct graph{
	int vcnt,ecnt;
	E  e[200010];//適宜変える
	int id[100010];//適宜変える
}G;

int esort(const void*a,const void*b){
	E*p=(E*)a,*q=(E*)b;
	if((*p).s<(*q).s)return -1;
	if((*p).s>(*q).s)return  1;
	if((*p).g<(*q).g)return -1;
	return 1;
}

G g;
void readgraph(){
	//適宜変える
	ll n;
	scanf("%lld",&n);
	rep(i,0,n-1){
		ll x,y,c;
		scanf("%lld%lld%lld",&x,&y,&c);
		g.e[2*i].s=x;
		g.e[2*i].g=y;
		g.e[2*i].c=c;
		g.e[2*i+1].s=y;
		g.e[2*i+1].g=x;
		g.e[2*i+1].c=c;
	}
	g.vcnt=n;
	g.ecnt=2*n-2;
	qsort(g.e,g.ecnt,sizeof(E),esort);
//	qsort(g.e,g.ecnt,sizeof(E),csort);

	int p=0;
	rep(i,0,g.vcnt){
		while(p<g.ecnt&&g.e[p].s<i)p++;
		g.id[i]=p;
	}
	g.id[g.vcnt]=g.ecnt;//番兵
}


//木の直径を求める2回dfs
//*
int*tyokkeitemp;
void tyokkeidfs(ll s){
	for(int i=g.id[s];i<g.id[s+1];i++){
		if(tyokkeitemp[g.e[i].g]==0){
			tyokkeitemp[g.e[i].g]=tyokkeitemp[s]+g.e[i].c;
			tyokkeidfs(g.e[i].g);
		}
	}
}
int tyokkei(){
	tyokkeitemp=(int*)calloc(g.vcnt+10,sizeof(int));
	tyokkeitemp[0]=1;
	tyokkeidfs(0);
	int M=0,Mi;
	rep(i,0,g.vcnt){
		if(tyokkeitemp[i]>M){
			M=tyokkeitemp[i];
			Mi=i;
		}
	}
	rep(i,0,g.vcnt)tyokkeitemp[i]=0;
	tyokkeitemp[Mi]=1;
	tyokkeidfs(Mi);
	rep(i,0,g.vcnt)M=max(M,tyokkeitemp[i]);
	free(tyokkeitemp);
	return M-1;
}
//*/

int main(){
	readgraph();
	printf("%d\n",tyokkei());
}


Measured memory_bytes: 10336
k=parse(Int,readline())
n=a=1
function f(x)
	s=0
	while x>0
		s+=x%10
		x=div(x,10)
	end
	s
end
for i=1:k
	println(n)
	if (n+a)*f(n+a*10)>(n+a*10)*f(n+a)
		a*=10
	end
	n+=a
end

Measured memory_bytes: 110216
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
const ll INF = (1ll << 60);

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    if ((int)(1.08 * i) == n) {
      cout << i << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules ! read_value {($ next : expr , ($ ($ t : tt ) ,* ) ) => {($ (read_value ! ($ next , $ t ) ) ,* ) } ; ($ next : expr , [$ t : tt ; $ len : expr ] ) => {(0 ..$ len ) . map (| _ | read_value ! ($ next , $ t ) ) . collect ::< Vec < _ >> () } ; ($ next : expr , chars ) => {read_value ! ($ next , String ) . chars () . collect ::< Vec < char >> () } ; ($ next : expr , usize1 ) => {read_value ! ($ next , usize ) - 1 } ; ($ next : expr , $ t : ty ) => {$ next () . parse ::<$ t > () . expect ("Parse error" ) } ; }
#[allow(unused_macros)]
macro_rules ! input_inner {($ next : expr ) => {} ; ($ next : expr , ) => {} ; ($ next : expr , $ var : ident : $ t : tt $ ($ r : tt ) * ) => {let $ var = read_value ! ($ next , $ t ) ; input_inner ! {$ next $ ($ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input {(source = $ s : expr , $ ($ r : tt ) * ) => {let mut iter = $ s . split_whitespace () ; let mut next = || {iter . next () . unwrap () } ; input_inner ! {next , $ ($ r ) * } } ; ($ ($ r : tt ) * ) => {let stdin = std :: io :: stdin () ; let mut bytes = std :: io :: Read :: bytes (std :: io :: BufReader :: new (stdin . lock () ) ) ; let mut next = move || -> String {bytes . by_ref () . map (| r | r . unwrap () as char ) . skip_while (| c | c . is_whitespace () ) . take_while (| c |! c . is_whitespace () ) . collect () } ; input_inner ! {next , $ ($ r ) * } } ; }

fn solve(a: usize, b: usize, s: &Vec<char>) -> bool {
    for i in 0..a {
        if !s[i].is_digit(10) {
            return false;
        }
    }
    if s[a] != '-' {
        return false;
    }
    for i in a + 1..a + b + 1 {
        if !s[i].is_digit(10) {
            return false;
        }
    }
    true
}

fn main() {
    input!{
        a: usize,
        b: usize,
        s: String,
    }
    if solve(a, b, &s.chars().collect::<Vec<_>>()) {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2152
#include<stdio.h>
int main()
{
  int a[3],d,i,j;
 scanf("%d%d%d",&a[0],&a[1],&a[2]);
 for(i=0;i<3;i++){
   for(j=i+1;j<3;j++){
 if(a[i]>a[j]){
   d=a[i];
   a[i]=a[j];
   a[j]=d;
 }
   }
 }
	 printf("%d %d %d\n",a[0],a[1],a[2]);
   return 0;
 }

Measured memory_bytes: 596
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		char s[] = sc.next().toCharArray();
		int min = 101, cnt, tmp;
		for (char j = 'a'; j <= 'z'; j++) {
			cnt = 0;
			tmp = 0;
			for (int i = s.length - 1; i >= 0; i--) {
				if (j == s[i]) {
					tmp = Math.max(tmp, cnt);
					cnt = 0;
				} else {
					cnt++;
				}
			}
			tmp = Math.max(tmp, cnt);
			min = Math.min(min, tmp);
		}
		System.out.println(min);
	}
}

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

int main()
{
	int x, a[99999], k=0;
	scanf("%d", &x);
	for(int i=2; i<=9; i++){
		for(int j=1; j<=100; j++){
			a[k] = round(pow(j, i));
			k++;
		}
	}

	sort(a, a+k);
	

	for(int i=0; i<1000; i++){
		if(a[i]>x){
			printf("%d", a[i-1]);
			return 0;
		}
	}

    return 0;
}


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

int main() {
	long long int N, NN, sum = 0;
	cin >> N;
	NN = N;

	for (int i = 0; i < 9; i++) {
		if (N > 10) {
			sum += N % 10;
			N /= 10;
		}
		else {
			sum += N % 10;
			break;
		}

	}
	cout << (NN % sum == 0 ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>

using namespace std;

int main()
{
	string s;
	int res;

	cin >> s;
	cout << s[0] << s.size() - 2 << s[s.size() - 1] << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int count[30]={0};
  char c;
  while(cin >> c){
    count[c-'a']++;
  }
  for(int i=0;i<26;i++){
    if(count[i]%2!=0){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

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

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}


int d[3] = {-1,0,1};
int main(){
   int h,w;cin>>h>>w;
   vector<string>s(h);
   int score[h][w];
   rep(i,h)rep(j,w)score[i][j] = 0;
   rep(i,h)cin>>s[i];
   rep(i,h){
       rep(j,w){
           if(s[i][j] == '#'){
               score[i][j] = -1;
               continue;
           }
           rep(k,3){
               rep(l,3){
                   int dy = i+d[k];
                   int dx = j+d[l];
                   if(dy<0 || dy>=h || dx<0 || dx>=w)continue;
                   if(s[dy][dx] == '#')score[i][j]++;
               }
           }
       }
   }
   rep(i,h){
       rep(j,w){
           if(score[i][j] == -1)cout<<'#';
           else cout<<score[i][j];
       }
       cout<<endl;
   }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<n;i++)
#define ll long long
 
#define pi pair < ll , ll >
#define pb push_back
#define mp make_pair
#define F first
#define S second
 
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
 
#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
using namespace std;

const ll mod = 1e9+7;

void solve() {
    ll x, n, i, j, k;
    cin>>x;
    for(i=-2000;i<=2000;i++) {
        for(j=-2000;j<=2000;j++) {
            if(i*i*i*i*i-j*j*j*j*j==x) {
                cout<<i<<" "<<j<<endl;
                return;
            }
        }
    }
}   

int main()
{
    fastIO;ll t=1;
    // cin>>t;
    while(t--)solve();
}


Measured memory_bytes: 3652
x1, y1, x2, y2 = map(int, input().split())
yd = y2 - y1
xd = x2 - x1

x3 = x2 - yd
y3 = y2 + xd

x4 = x3 - xd
y4 = y3 - yd

print(x3,y3,x4,y4)

Measured memory_bytes: 2940
#include<stdio.h>
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define INFTY 1000000000
#define MAX 100
typedef struct{
  int color; //全て白(0)に初期化済み
  int id;
  int distance;
  int parent;
}DOT;

DOT A[MAX];
int G[MAX][MAX];

int MinTree(int n){
  int total=0;
  int min_box;
  int flag;
  int i;
  int u,v;

  A[0].distance=0;
  
  while(1){
    int min_box=INFTY;
    int flag=0;
    int u,v;

    for(i=0;i<n;i++){
      if(A[i].color!=BLACK && A[i].distance<min_box){//グループで最も最小の手を持つ先にある番号

	min_box=A[i].distance;
	u=i;
	flag=1;

      }
    }
    if(flag==0)break;
    A[u].color=BLACK;
    
    for(v=0;v<n;v++){
      if(G[u][v]!=INFTY && A[v].color!=BLACK){
	if(A[v].distance>G[u][v]+A[u].distance){//vまでの距離=uからv+uまで
	  A[v].distance=G[u][v]+A[u].distance;
	  A[v].parent=u;
	  A[v].color=GRAY;
	}
      }
    }
  }
  //  for(v=1;v<n;v++){
  //total+=G[v][A[v].parent];
  //}
  return total;
}


int main(){
  int n;
  int i,j;
  int id,agree,value,dis;
  
  for(i=0;i<100;i++){//INITIATE
    A[i].parent=-1;
    A[i].distance=INFTY;
    for(j=0;j<100;j++){
      G[i][j]=INFTY;
    }
  }
  
  scanf("%d",&n);//INPUT
  
  for(i=0;i<n;i++){
    scanf("%d%d",&id,&agree);
    for(j=0;j<agree;j++){
      
      scanf("%d%d",&value,&dis);
      G[id][value]=dis;
    }
  }
  
  MinTree(n);
  
  for(i=0;i<n;i++){
    printf("%d %d\n",i,A[i].distance);//PRINT
  }
  return 0;
}



Measured memory_bytes: 2080
import sys
input = sys.stdin.buffer.readline
#from itertools import permutations

def gcd(a: int, b: int):
    while b: a, b = b, a%b
    return a

def lcm(a: int, b: int):
    return a * b // gcd(a, b)


def main():
    N = int(input())
    mT = [tuple(input().decode().split()) for _ in [0,]*N]
    #N,M = map(int, input().split())
    X = input().decode().rstrip()

    p = 0
    res = 0
    for s,t in mT:
        nt = int(t)
        if p:
            res += nt
        if s==X:
            p = 1

    print(res)
    #vP = tuple(map(int, input().split()))
    #vA = set(map(int, input().split()))
    
    #print(lcm(N,M))
    #print(l, file=sys.stderr)
    #print("Yes" if X<=500*K else "No")
    #print(S.count("ABC"))


if __name__ == "__main__":
    main()


Measured memory_bytes: 3316
N = int(input())
for _ in range(N):
    P = list(map(float,input().split()))
    a, b, c, d = [complex(P[i*2],P[i*2+1])*1000000 for i in range(4)] 
    parallel = ((a-b).conjugate() *(c-d)).imag ==0
    print("YES" if parallel else "NO")




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

using namespace std;

bool StudentStatus[31];

int main() {
	int id;
	
	memset(StudentStatus, false, sizeof(StudentStatus));
	for (int i = 0; i < 28; ++i) {
		cin >> id;
		StudentStatus[id] = true;
	}
	for (int i = 1; i < 31; ++i) {
		if (StudentStatus[i]) {
			continue;
		}
		cout << i << endl;
	}

	return 0;
}


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

int main()
{
	string a;
	char b = '0';
	char w = '1';
	cin >> a;
	int cnt1 = 0, cnt2 = 0;
	for (int i = 0;i < a.length();i++) {
		if (i % 2 == 1) {
			if (a[i] == b)cnt1++;else cnt2++;
		}
		else {
			if (a[i] == w)cnt1++;else cnt2++;
		}
	}
	
	if (cnt1 > cnt2)cout << cnt2 << endl;
	else cout << cnt1 << endl;
}

Measured memory_bytes: 512
n = int(input())
s = input()

ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            #print(str(i) + str(j)+ str(k))
            fi = s.find(str(i))
            if fi < 0:
                continue
            fj = s[fi+1:].find(str(j))
            if fj < 0:
                continue
            fk = s[(fi+1)+(fj+1):].find(str(k))
            if fk < 0:
                continue
            #print(str(i) + str(j)+ str(k), str(fi) + str(fj)+ str(fk))
            ans += 1
print(ans)




Measured memory_bytes: 38512
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vv vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 1000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;

signed main(void) {
    int H, W; cin >> H >> W;
    int h, w; cin >> h >> w;
    cout << (H-h) * (W-w) << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        long n=scanner.nextLong();
        long a=scanner.nextLong();
        long b=scanner.nextLong();
        long aa=n%(long)((long)a+(long)b);
        long as=(long)((long)n/(long)((long)a+(long)b));
        long ans=(long)((long)((long)as*(long)a)+ (long)Math.min((long)aa,(long)a));
        System.out.println(ans);
    }
}


Measured memory_bytes: 23124
import heapq
n,m=map(int,input().split())
a=list(map(lambda x:int(x)*(-1),input().split()))
heapq.heapify(a)
for _ in range(m):
  b=heapq.heappop(a)
  heapq.heappush(a,-(-b//2))
print(-sum(a))

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

vector<string> ans;

void dfs(int l = 1, int n = 0, string s = "")
{
  if (l == 0) {
    ans.push_back(s);
    return;
  }
  for (int i = 0; i <= n; i++) {
    s.push_back('a' + i);
    dfs(l - 1, max(n, i + 1), s);
    s.pop_back();
  }
}

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

  dfs(n);

  for (auto&& e : ans) {
    cout << e << endl;
  }
}


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

int main(void){

  int K=0,U=0,P=0,C=0,ans;
  string KUPC;

  cin >> KUPC;

  int size = KUPC.size();
  //Kテ」ツつ津ヲツ、ツ愿ァツエツ「
  for(int i = 0; i < size; i++){
    if(KUPC[i] == 'K') K++;
  }

  //Uテ」ツつ津ヲツ、ツ愿ァツエツ「
  for(int i = 0; i < size; i++){
    if(KUPC[i] == 'U') U++;
  }

  //Pテ」ツつ津ヲツ、ツ愿ァツエツ「
  for(int i = 0; i < size; i++){
    if(KUPC[i] == 'P') P++;
  }

  //Cテ」ツつ津ヲツ、ツ愿ァツエツ「
  for(int i = 0; i < size; i++){
    if(KUPC[i] == 'C') C++;
  }

  ans = min(K,U);
  ans = min(P,ans);
  ans = min(C,ans);

  cout << ans << endl;


  return 0;
}

Measured memory_bytes: 1188
import java.util.*;
public class Main {
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      String s = sc.next();
      String wether = "Sunny";
      
      if (s.equals("Sunny")) {
        wether = "Cloudy";
      } else if (s.equals("Cloudy")) {
        wether = "Rainy";
      }
          
      System.out.println(wether);
      }
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define repR(i, n) for(ll i = n; i >= 0; i--)
#define For(i, m, n) for(ll i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef long double ld;
using namespace std;
struct Fast {Fast(){std::cin.tie(0);std::ios::sync_with_stdio(false);}} fast;
ll gcd(ll a, ll b){
    ll r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

bool vector_find(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
    if (index != vec.size()) {
        return true;
    }
    else {
        return false;
    }
}


int main(void){
    double result;
    ll N, M;
    cin >> N >> M;
    if(N >= M){
        cout << 0 << endl;
        return 0;
    }
    
    vector<ll> X;
    rep(i, M){
        ll x;
        cin >> x;
        X.push_back(x);
    }
    sort(ALL(X));
    
    vector<ll> Xdif;
    rep(i, M-1){
        Xdif.push_back(X[i+1] - X[i]);
    }
    sort(ALL(Xdif));
    
    ll sum = 0;
    rep(i, Xdif.size() - (N - 1)){
        sum += Xdif[i];
    }
    
    cout << sum << endl;
}


Measured memory_bytes: 2548
k = int(input())
runrun = []

for i in range(1, 10):
    runrun.append(i)

while(1):
    if k <= len(runrun):
        print(runrun[k-1])
        break
    k -= len(runrun)
    old = []
    runrun, old = old, runrun
    for x in old:
        for i in range(-1, 2):
            d = x%10 + i
            if d < 0 or d > 9:
                continue
            nx = x*10 + d
            runrun.append(nx)

Measured memory_bytes: 18064
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <cassert>
#define INF 1000000000000000000
#define MOD 1000000007
#define sym cout<<"---------"<<endl;
#define ll long long
#define mk make_pair
#define en endl
#define RE return 0
#define int ll
#define P pair<int,int>
using namespace std;
int dx[5]={1,0,-1,0,0},dy[5]={0,1,0,-1,0};
int gcd(int a,int b){if(a%b==0){return b;}else return gcd(b,a%b);}
int lcm(int a,int b){if(a==0){return b;} return a/gcd(a,b)*b;}

#define MAX 100005
int n,t,q;
struct people{
	int where,dir;
};
people peo[MAX];
bool done[MAX];
int d[MAX];

signed main(){
	cin>>n>>t>>q;
	
	for(int i=1; i<=n; i++){
		int a,b; cin>>a>>b;
		peo[i].where=a; peo[i].dir=b;
		done[i]=false;
	}
	vector<int> col;
	for(int i=1; i<=n-1; i++){
		if(peo[i].dir==1){
			if(peo[i+1].dir==2&&2*t>peo[i+1].where-peo[i].where){
				int c=(peo[i+1].where+peo[i].where)/2;
				col.push_back(c);
				done[i+1]=done[i]=true;
				d[i+1]=d[i]=c;
			}
		}
	}
	sort(col.begin(), col.end());
	for(int i=0; i<q; i++){
		int a; cin>>a;
		if(done[a]){
			cout<<d[a]<<en;
			continue;
		}
		bool ok=false;
		P ans; ans.first=2*INF+1;
		for(int j=0; j<col.size(); j++){
			int w=col[j];
			if(w-peo[a].where>0&&peo[a].dir==1){
				if(w-peo[a].where<t){
					if(ans.first>w-peo[a].where){ 
						ans.second=w;
						ans.first=abs(w-peo[a].where);
					}
					ok=true;
				}
			}else if(w-peo[a].where<0&&peo[a].dir==2){
				if(peo[a].where-w<t){
					if(ans.first>peo[a].where-w){ 
						ans.second=w;
						ans.first=abs(peo[a].where-w);
					}
					ok=true;
				}
			}
		}
		if(!ok) cout<<(peo[a].dir==1 ? peo[a].where+t:peo[a].where-t)<<en;
		else cout<<ans.second<<en;
	}
}




Measured memory_bytes: 5696