akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
import java.io.*;

public class Main
{
	public static void main(String args[])
	{
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String line, moto;
		try
		{
			moto = reader.readLine();
			int ans = 0;
			while(true)
			{
				line = reader.readLine();
				if(line.equals("END_OF_TEXT"))
				{
					break;
				}
				String[] bun = line.split(" ",0);
				for (int i = 0; i < bun.length; i++)
				{
					bun[i] = bun[i].toLowerCase();
					if(bun[i].equals(moto))
					{
						++ans;
					}
				}
			}
			System.out.println(ans);
		}
		catch(IOException e)
		{
			System.out.println(e);
		}
	}
}


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

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
typedef struct data{
	int now;
	int cost;
}data;
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
int a,b,c,d, A[100], B[100], C[100][100], D[100][100][100];
string s, t, r;




int main(){
	cin >> a;
	if(a < 1200){
		cout << "ABC" << endl;
	}else if(a < 2800){
		cout << "ARC" << endl;
	}else{
		cout << "AGC" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
class in{struct myIterator{int it;const bool rev;explicit constexpr myIterator(int it_, bool rev=false):it(it_),rev(rev){}int operator*(){return it;}bool operator!=(myIterator& r){return it!=r.it;}void operator++(){rev?--it:++it;}};const myIterator i,n;public:explicit constexpr in(int n):i(0),n(n){}explicit constexpr in(int i,int n):i(i,n<i),n(n){}const myIterator& begin(){return i;}const myIterator& end(){return n;}};

#include <bits/stdc++.h>
using namespace std;

int dp[2001][2001]; //I
int dp2[2001][2001]; //OI
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for(int i : in(n + 1)) for(int j : in(m + 1)) {
        ans = max(ans, dp[i][j]);
        if(i < n) {
            if(s[n - i - 1] == 'I')
              dp[i + 1][j] = max(dp[i + 1][j], dp2[i][j] + 1);
            else if(dp[i][j] > 0)
              dp2[i + 1][j] = max(dp2[i + 1][j], dp[i][j] + 1);
        }
        if(j < m) {
            if(t[m - j - 1] == 'I')
              dp[i][j + 1] = max(dp[i][j + 1], dp2[i][j] + 1);
            else if(dp[i][j] > 0)
              dp2[i][j + 1] = max(dp2[i][j + 1], dp[i][j] + 1);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 34504
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <climits>
#define bogo_sort   std::sort
#define bozo_sort   std::stable_sort
#define alles(obj)  obj.begin(), obj.end()
#define elif        else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo        std::cout <<
#define read        std::cin >>
#define endl        std::endl
#define fin         << '\n'
#define bash        push_back
#define makePair    std::make_pair
#define _           << ' ' <<
// type-define
#define Stack       std::stack
#define Queue       std::queue
#define Set         std::set
#define PQueue      std::priority_queue
#define Vector      std::vector
#define Pair        std::pair
#define Map         std::map
#define UMap        std::unordered_map
#define Greater     std::greater
using String  =     std::string;
using llong   =     long long;
using boolean =     bool;
using Pii     =     Pair<int, int>;
using Vi      =     Vector<int>;
using Vii     =     Vector<Pii>;
// utils
constexpr int   dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int   dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int   INF  = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    llong power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    llong power ( llong x, llong n ) { return power( x, n, 1000000007 ); }
    llong gcd   ( llong x, llong y ) { return x % y ? gcd( y, x % y ) : y; }
    llong lcm   ( llong x, llong y ) { return ( x / gcd(x, y) * y ); }
    llong abs   ( llong n )          { return ( n < 0 ) ? -n : n; }
    template<class A, class B>inline bool chmax ( A &a, const B &b ) { return b > a ? a = b, true : false; }
    template<class A, class B>inline bool chmin ( A &a, const B &b ) { return b < a ? a = b, true : false; }
    boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
}

namespace Rlyeh {

    signed call_of_Cthulhu( signed datum ) {

        String s;
        int k;
        read s >> k;
        for ( int i = 0; i < k; i++ ) {
            if ( s[i] != '1' ) {
                echo s[i] fin;
                return 0;
            }
        }
        echo 1 fin;

        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); echo std::fixed << std::setprecision(8); int main_result = Rlyeh::call_of_Cthulhu(114514); return main_result;}


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

int main() {

  ios::sync_with_stdio(false);
  cout.tie(nullptr);
  cin.tie(nullptr);

  int a, b;
  cin >> a >> b;

  for (int i = 1; i < 100000; ++i) {
    if ((8*i)/100 == a && (10*i)/100 == b) {
      cout << i << '\n';
      return 0;
    }
  }

  cout << -1 << '\n';
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define NIL NULL

struct node{
  int key;
  struct node *r;
  struct node *l;
  struct node *p;
};

typedef struct node * Node;

Node root;

void insert(int v){
  Node y=NIL;
  Node x=root;
  Node z;

  z=malloc(sizeof(struct node));
  z->key=v;
  z->l=NIL;
  z->r=NIL;

  while(x!=NIL){
    y=x;

    if(z->key < x->key) x=x->l;
    else x=x->r;
  }

    z->p=y;

    if(y==NIL) root=z;
    else if(z->key < y->key) y->l=z;
    else y->r=z;
}

void inorder(Node u){
  if(u!=NIL){
    inorder(u->l);
    printf(" %d",u->key);
    inorder(u->r);
  }
}

void preorder(Node u){
  if(u!=NIL){
    printf(" %d",u->key);
    preorder(u->l);
    preorder(u->r);
  }
}

Node find(Node a,int k){
  if (a==NIL || k==a->key) return a;
  if(k < a->key) return find(a->l,k);
  else return find(a->r,k);
}

int main(){
  int n,i,x;
  char com[20];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s",com);

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

Measured memory_bytes: 19364
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define llu unsigned long long int
#define Endl endl
#define mod  998244353
#define mkp make_pair
#define pb push_back
#define cin(n) scanf("%d",&n)
#define cout(n) printf("%d ",n)
#define sf(n) scanf("%d",&n)
#define pf(n) printf("%d ",n)
#define bitget(n) __builtin_popcountll(n)
ll dx[] = {1,1,0,-1,-1,-1,0,1};
ll dy[] = {0,-1,-1,-1,0,1,1,1};
ll dxx[] = {1,-1,0,0};
ll dyy[] = {0,0,-1,1};
ll modexpo(ll x,ll y){if(y==0)return 1;if(y%2){ll viky=modexpo(x,y/2);
return (((x*viky)%mod)*viky)%mod;}else{ll viky=modexpo(x,y/2);return (viky*viky)%mod;
}}
bool isvalid(ll x,ll y,ll n, ll m) { return (x>=0&&x<n&&y>=0&&y<m); }

int main() {
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll n;
    string s,p;
    cin>>n;
    
    cin>>s>>p;
    ll j = 0;
    ll k = 0;

    for(ll i=0;i<2*n;i++){
        if(i%2 == 0){
            cout<<s[j];

            j++;
        }else{
            cout<<p[k];
            k++;
        }
    }

    return 0;
}

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

typedef unsigned long long ull;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
const ull mod = 1e9 + 7;

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s,t,u;	cin>>s>>t;
	int a,b;	cin>>a>>b;
	cin>>u;
	if(s==u)	cout<<a-1<<" "<<b<<endl;
	else	cout<<a<<" "<<b-1<<endl;

    return 0;
}




Measured memory_bytes: 256
INF = float("inf")

def bellman_ford(edges, n, s):
    d = [0] + [INF] * (n-1)
    for i in range(n):
        for f, t, c in edges:
            if d[f] == INF: continue
            if d[t] > d[f] + c:
                if i == n-1: d[t] = -INF
                else: d[t] = d[f] + c
    for i in range(n):
        for f, t, c in edges:
            if d[f] == INF: continue
            d[t] = min(d[t], d[f] + c)
    return d

n, m, p = map(int, input().split())
es = [None] * m
for i in range(m):
    f, t, c = map(int, input().split())
    es[i] = (f-1, t-1, -(c-p))

d = bellman_ford(es, n, 0)
print(-1 if d[n-1] == -INF else max(0, -d[n-1]))


Measured memory_bytes: 52328
// abc051_a
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    string S;
    cin >> S;

    S[5] = ' ';
    S[13] = ' ';
    print(S);
    


    return 0;
}


Measured memory_bytes: 256
x = int(input())
import numpy as np

def seachPrimeNum(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum

l = seachPrimeNum(100010)
i = 0
while l[i] < x:
  i += 1
print(l[i])

Measured memory_bytes: 25432
N = gets.to_i
A = gets.split.map(&:to_i)
ans = 1
if A.include?(0)
  puts 0
  exit
end
A.each do |n|
  ans *= n
  if ans > 1_000_000_000_000_000_000
    ans = -1
    break
  end
end
puts ans

Measured memory_bytes: 21536
n,m=map(int,input().split())
g=[[]for _ in range(n)]
for i in range(m):
  a,b,c=map(int,input().split())
  a,b=a-1,b-1
  g[a].append((c,b,i))
  g[b].append((c,a,i))
no_used=[1]*m
from heapq import heapify,heappop,heappush
def dks(t0):
  todo=[[0,t0,-1]]
  heapify(todo)
  seen=[0]*n
  while todo:
    d,t,i=heappop(todo)
    if seen[t] and seen[t]<d:continue
    seen[t]=d
    if i>-1:no_used[i]=0
    l=g[t]
    for d_,t_,i_ in l:
      heappush(todo,[d+d_,t_,i_])
for i in range(n):
  dks(i)
print(sum(no_used))

Measured memory_bytes: 4596
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w;
    cin >> h >> w;
    vvint s(h,vint(w,0));
    REP(i,h){
        string str;
        cin >> str;
        REP(j,w){
            if(str[j]=='#'){
                s[i][j]=1;
            }
        }
    }
    REP(i,h){
        REP(j,w){
            if(s[i][j]==1){
                if((i>0&&s[i-1][j]==1)||(i<h-1&&s[i+1][j]==1)||(j>0&&s[i][j-1]==1)||(j<w-1&&s[i][j+1]==1)){

                }else{
                    puts("No");
                    return 0;
                }
            }
        }
    }
    puts("Yes");
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

  public static void main(String[] args) {
    String[] verdicts = {"AC", "WA", "TLE", "RE"};
    Map<String, Integer> map = new HashMap<>();
    int caseNum = scanner.nextInt();
    for (int i = 0; i < caseNum; i++) {
      String s = scanner.next();
      map.put(s, map.getOrDefault(s, 0) + 1);
    }
    for (String v : verdicts) {
      System.out.println(v + " x " + (map.getOrDefault(v, 0)));
    }
  }

  private static final Scanner scanner = new Scanner(System.in);
}


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

#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,n) for(int i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define MP make_pair

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int n;
  scanf("%d", &n);

  vector<int> v;
  REP(i,3 * n){
    int t;
    scanf("%d", &t);
    v.pb(t);
  }

  sort(ALL(v), greater<int>());

  llong ans = 0; 
  REP(i,n){
    ans += v[i * 2 + 1]; 
  }
  
  printf("%lld\n", ans);

  return 0;
}



Measured memory_bytes: 2420
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
using namespace std;
int main() {
	long long int A, B, X;
	cin >> X >> A >> B;
	if (B <= A)cout << "delicious";
	else if (B <= A + X)cout << "safe";
	else cout << "dangerous";
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}



int main(){
  int H, W; cin >> H >> W;
  int sy,sx,ty,tx;cin>>sy>>sx>>ty>>tx;
  sy--; sx--; ty--; tx--;
  vector<string> S(H); rep(i,H) cin >> S[i];
  int inf = 1e9;
  vector<vector<int>> D(H, vector<int>(W,inf));
  D[sy][sx]=0;


  vector<vector<bool>> used(H, vector<bool>(W,false));
  priority_queue<pair<int,pair<int,int>>,
                 vector<pair<int,pair<int,int>>>,
                 greater<pair<int,pair<int,int>>>> q;
  q.push({0,{sy,sx}});
  while(!q.empty()){
    int d = q.top().first; pair<int,int> to = q.top().second; q.pop();
    if(used[to.first][to.second]) continue;
    used[to.first][to.second] = true; D[to.first][to.second] = d;
    int y = to.first; int x =to.second;
    for(int dy=-2;dy<=2;dy++){
      for(int dx=-2;dx<=2;dx++){
        if(dy==0&&dx==0)continue;
        int dd=abs(dx)+abs(dy);
        if(y+dy>=0&&y+dy<H&&x+dx>=0&&x+dx<W&&S[y+dy][x+dx]=='.')q.push({D[y][x]+(dd==1?0:1),{y+dy,x+dx}});
      }
    }
  }

  if(D[ty][tx]>1e8) cout << -1 << endl;
  else cout << D[ty][tx] << endl;
  return 0;
}


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

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
const int inf = 1000000001;
const ll INF = 1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<<fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };

static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;
static const int N = 310;

int n;
vll hyou1(N, vl(N, INF)), hyou2(N, vl(N, INF));
vector< vector< pair<int, int> > > adj(N, vector< pair<int, int> >());
vl d(N, INF);



int main() {
	cin >> n;
	int i, j, k;
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			cin >> hyou1[i][j];
		}
	}
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			if (i == j) {
				if (hyou1[i][j] != 0) {
					cout << -1 << endl;
					return 0;
				}
			}
			else {
				if (hyou1[i][j] != hyou1[j][i]) {
					cout << -1 << endl;
					return 0;
				}
			}
		}
	}
	for (i = 0; i < n; i++) {
		for (j = 0; j < i; j++) {
			bool flag = false;
			for (k = 0; k < n; k++) {
				if (k == i || k == j) {
					continue;
				}
				if (hyou1[i][j] == hyou1[i][k] + hyou1[k][j]) {
					flag = true;
				}
			}
			if (!flag) {
				adj[i].push_back(make_pair(hyou1[i][j], j));
				adj[j].push_back(make_pair(hyou1[i][j], i));
			}
		}
	}
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			if (i == j) {
				hyou2[i][j] = 0;
			}
		}
	}
	for (i = 0; i < n; i++) {
		for (j = 0; j < adj[i].size(); j++) {
			hyou2[i][adj[i][j].second] = adj[i][j].first;
		}
	}
	for (k = 0; k < n; k++) {
		for (i = 0; i < n; i++) {
			for (j = 0; j < n; j++) {
				if (hyou2[i][j] > hyou2[i][k] + hyou2[k][j]) {
					hyou2[i][j] = hyou2[i][k] + hyou2[k][j];
				}
			}
		}
	}
	if (hyou1 != hyou2) {
		cout << -1 << endl;
		return 0;
	}
	ll sum = 0;
	for (i = 0; i < n; i++) {
		for (j = 0; j < adj[i].size(); j++) {
			sum += adj[i][j].first;
		}
	}
	sum /= 2;
	cout << sum << endl;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template<class T> using vc = vector<T>;
template<class T> using vvc = vc<vc<T>>;
constexpr ll ten(int n){return (n==0) ? 1 : 10 * ten(n-1);}
#define rng(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,N) for(int i=0;i<(int)(N);i++)
#define gnr(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define per(i,b) gnr(i,0,b)
#define a first
#define b second
#define eb emplace_back
#define pb push_back
#define bg begin()
#define ed end()
#define all(x) x.begin(),x.end()
template<class T, class U> void chmin(T& t, const U& u){ if(t>u) t = u;}
template<class T, class U> void chmax(T& t, const U& u){ if(t<u) t = u;}

#ifdef LOCAL
#define show(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif

template<class T,class U>
ostream& operator<<(ostream& os, const pair<T,U>& p){
    return os << "P(" << p.fs << ", " << p.sc << ")";
}
template<class T> ostream& operator<<(ostream& os, const vc<T>& v){
    os << "[";
    for(auto d: v) os << d << ", ";
    return os << "]";
}

using vi=vector<int>;
using pi=pair<int,int>;

const int inf=INT_MAX/2-100;

struct maxmatching{
	struct E{int a,b;};
	const vvc<int>&g;
	int n,sz;
	vi p,t,mt;
	vc<E> f;
	int non(int v){
		return t[v]!=sz||p[v]==-1?v:(p[v]=non(p[v]));
	}
	void R(int a,int b){
		int d=mt[a];
		mt[a]=b;
		if(d==-1||mt[d]!=a)return;
		if(f[a].b==-1){
			mt[d]=f[a].a;
			R(f[a].a,d);
		}else{
			R(f[a].a,f[a].b);
			R(f[a].b,f[a].a);
		}
	}
	bool arg(int rt){
		queue<int> q;
		t[rt]=sz;
		p[rt]=-1;
		f[rt]=E{-1,-1};
		q.push(rt);
		while(q.size()){
			int a=q.front();q.pop();
			for(auto b:g[a]){
				if(b==rt)continue;
				if(mt[b]==-1){
					mt[b]=a;
					R(a,b);
					return true;
				}
				if(t[b]==sz){
					int x=non(a),y=non(b);
					if(x==y)continue;
					int z=rt;
					while(x!=rt||y!=rt){
						if(y!=rt)swap(x,y);
						if(f[x].a==a&&f[x].b==b){
							z=x;
							break;
						}
						f[x]=E{a,b};
						x=non(f[mt[x]].a);
					}
					for(auto v:{non(a),non(b)}){
						while(v!=z){
							t[v]=sz;
							p[v]=z;
							q.push(v);
							v=non(f[mt[v]].a);
						}
					}
					continue;
				}
				if(t[mt[b]]==sz)continue;
				f[b]=E{-1,-1};
				t[mt[b]]=sz;
				p[mt[b]]=b;
				f[mt[b]]=E{a,-1};
				q.push(mt[b]);
			}
		}
		return false;
	}
	maxmatching(const vvc<int>&gg):g(gg),n(g.size()),sz(0),
		p(n),t(n,-1),mt(n,-1),f(n){
			rep(i,n)if(mt[i]==-1)
				sz+=arg(i);
		}
};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int n,m;cin>>n>>m;
    vvc<int> w(n);
    rep(i,m){
		int k;cin>>k;
		rep(_,k){
			int v;cin>>v;
			v--;
			w[v].pb(i);
		}
	}
	
	int ans=0;
	vi u(m);
	vvc<int> g(m);
	
	rep(i,n){
		if(w[i].size()==0){
			ans++;
		}else if(w[i].size()==1){
			u[w[i][0]]=1;
		}
	}
	
	rep(i,n)if(w[i].size()==2){
		int a=w[i][0],b=w[i][1];
		if(!u[a]&&!u[b]){
			g[a].pb(b);
			g[b].pb(a);
		}
	}
	
	ans+=count(all(u),1);
	ans+=maxmatching(g).sz;
	
	cout<<ans<<endl;
}



Measured memory_bytes: 9412
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include <cstring>
#include <functional>
//#include<unordered_map>
//#include<unordered_set>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P; 
const int N = 200005;
//////////////////////////////

Int n, a;
Int x[55];
Int dp[55][55][2555];

void solve()
{
	cin >> n >> a;
	for (int i = 1; i <= n; i++) {
		cin >> x[i];
	}
	dp[0][0][0] = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= i; j++) {
			for (int s = 0; s < 2555; s++) {
				if (j == 0 || s == 0) dp[i][j][s] = 1;
				dp[i][j][s] = dp[i - 1][j][s];
				if (s - x[i] >= 0 && j - 1 >= 0) {
					dp[i][j][s] += dp[i - 1][j - 1][s - x[i]];
				}
			}
		}
	}

	Int ans = 0;
	for (int j = 1; j <= n; j++) {
		ans += dp[n][j][j*a];
	}

	cout << ans << endl;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(13);
	solve();
	return 0;
}


Measured memory_bytes: 30312
def main():
    import sys
    input = sys.stdin.readline
    S = input().strip()
    a_cnt = 0
    state = 0
    ans = 0
    for s in S:
        if s == 'A':
            if state == 0:
                a_cnt += 1
            else:
                a_cnt = 1
                state = 0
        elif s == 'B':
            if state == 0:
                state = 1
            else:
                a_cnt = 0
        elif s == 'C':
            if state == 1:
                ans += a_cnt
                state = 0
            else:
                a_cnt = 0

    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3500
n = int(input())
s = []
for  _ in range(n):
    s.append(input())

a = 0
b = 0
c = 0
d = 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 ", a)
print("WA x ", b)
print("TLE x ", c)
print("RE x ", d)

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

int main() {
    int N, C, K;
    cin >> N >> C >> K;
    vector<int> T(N), S(N);
    rep(i,N) { cin >> T[i]; }
    sort(T.begin(), T.end());
    rep(i,N) { S[i] = T[i]+K; }
    int ans = 0, pos = 1, cnt = 1, lim = S[0];
    rep(i,N) {
        if (cnt < C && T[pos] <= lim && lim <= S[pos]) {
            pos++;
            cnt++;
        }
        else {
            ans++;
            lim = S[pos];
            pos++;
            cnt = 1;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
using System;
 
namespace ConsoleApplication13
{
    class Program
    {
        static void Main(string[] args)
        {
            int a,b;
            int t;
            while(true)
            {
                string[] str = Console.ReadLine().Split(' ');
                a = int.Parse(str[0]);
                b = int.Parse(str[1]);
                if ((a == 0) && (b == 0))
                    break;
 
                if(a>b)
                {
                    t = a;
                    a = b;
                    b = t;
                }
 
                Console.WriteLine("{0} {1}", a, b);
 
            }
        }
    }
}
 

Measured memory_bytes: 9396
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

use std::collections::BTreeSet;

fn main() {
    let mut gacha: BTreeSet<String> = BTreeSet::new();
    let n: usize = read();
    gacha = (0..n).map(|_| read()).collect();

    println!("{}", gacha.len());
}


Measured memory_bytes: 16320
#include<cstdio>
#include<algorithm>
#include<cctype>
#include<cstring>
#include<iostream>
#include<cmath>
#define LL long long
#define N (100005)
using namespace std;
int a,b,c; 
template <typename T> void read(T&t) {
	t=0;
	bool fl=true;
	char p=getchar();
	while (!isdigit(p)) {
		if (p=='-') fl=false;
		p=getchar();
	}
	do {
		(t*=10)+=p-48;p=getchar();
	}while (isdigit(p));
	if (!fl) t=-t;
}
int main(){
	read(a),read(b),read(c);
	printf("%d",min(c,b/a));
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Debug_array(a,n) for (ll i=(0); i<(n); i++) cout<<a[i]<<" "
#define Foe(i,s,e) for (ll i=(s); i<=(e); i++)
#define Fod(i,s,e) for (ll i=(s)-1; i>=(e); i--)
#define Mod 1000000007
#define pii pair<ll,ll>
#define fi first
#define se second
#define endl "\n"
#define mp make_pair
#define big_prime 15486277
#define bigger_prime 179424697
#define biggest_prime 32416188691
//#define random_shuffle(indices.begin(), indices.end());
//std::random_device rd;
//std::mt19937 g(rd());
//std::shuffle(v.begin(), v.end(), g);
using namespace __gnu_pbds; 
using namespace std;

typedef long long ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set; 

#define MAX 5002

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll a,p;cin>>a>>p;
	p += 3*a;
	cout<<p/2<<endl;











	
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
int x[100000+5],y[100000+5]={0},d;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	for(int i=1;i<=a;i++)
		x[i]=b;
	for(int i=1;i<=c;i++){
		cin>>d;
		y[d]++;
	}
	for(int i=1;i<=a;i++){
		if((x[i]-(c-y[i]))<=0)
			cout<<"No"<<endl;
		else
			cout<<"Yes"<<endl;
	}
} 

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

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); ++i)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ELEM(array) (sizeof (array)/sizeof *(array))
#define MAX_N 100005
#define MS(m,v) memset(m,v,sizeof(m))
#define SAFE_FREE(ptr) if( ptr != NULL ){ free(ptr); ptr = NULL; }
typedef unsigned int UINT;
typedef long long  ll;
typedef pair<int, int> P;

int n;
int dp[105][10005];
P wv[105];
int solve(int i, int j)
{
	if (dp[i][j] > 0) return dp[i][j];

	int res;
	if (n==i)res = 0;
	else if (j < wv[i].first)res = solve(i + 1, j);
	else
	{
		res = max(solve(i + 1, j), solve(i + 1, j - wv[i].first) + wv[i].second);
	}
	dp[i][j] = res;
	return res;
}

int main()
{

	int w;
	cin >> n >> w;
	REP(i, n){
		dp[i][0] = 0;
		cin >> wv[i].second >> wv[i].first;
	}
	REP(i, w)dp[0][i] = 0;

	cout << solve(0, w) << endl;

	return 0;
}

Measured memory_bytes: 5112
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define fop(i,m,n) for (int i=(m);i<(n);++i)
#define test(x) cout << #x << ' ' << x << endl;
#define eb emplace_back
#define pb push_back
#define mp make_pair 


int main () {
	string s1,s2;
	cin >> s1 >> s2;
	int k=0;
	fop (i,0,3) {
		if (s1[i]==s2[i]) k++;
	}
	cout << k << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public  static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		int i;
		int j;
		int sum = 0;
		int H [] = new int[N] ;

		for(i =0;i < N;i++) {
			int B = sc.nextInt();
			H[i] = B;
		}

		for(i = 0;i < N;i++) {
			for(j = i+1;j < N ; j++) {
				sum = sum + H[i]*H[j];

			}
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 23764
// inputに入力データ全体が入る
function Main(input) {

	var tmp=input.split("\n");
  	var tmp2=tmp[1].split(" ");
	var tmp3=tmp[0].split(" ");
	var h=tmp3[0];
  	var n=tmp3[1];
  	var at=0;
	var count=0;
	for(i=0;i<n;i++){
		at=at+parseInt(tmp2[i],10);
    }
  
 	if(h<=at){
  		console.log('Yes');
	}else{
    	console.log('No');
    }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21064
#include<bits/stdc++.h>
            using namespace std;
            #define rep(i,b) for(i=0;i<b;++i)
            #define repp(i,a,b) for(i=a;i<b;++i)
            #define endl "\n"
            #define LLONG_MAX 99999999999999
            typedef long long int lli;
            int main(){
                lli i,t,n,m,k;
                cin>>n>>m;
                priority_queue<lli> pq;
                rep(i,n){
                    cin>>k;
                    pq.push(k);
                }
                while(m--){
                    t=pq.top();
                    pq.pop();
                    t=floor(double(t)/2.0);
                    pq.push(t);
                }
                lli ans=0;
                while(!pq.empty()){
                    ans+=pq.top();
                    pq.pop();
                }
                cout<<ans<<endl;

                return 0;
            }
















Measured memory_bytes: 1400
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.format;

void main() {
  int n, k;
  int r, s, p;
  auto z = readln;
  formattedRead (z, " %d %d", &n, &k);
  z = readln;
  formattedRead (z, " %d %d %d", &r, &s, &p);
  long res;
  z = readln;
  void upd (char c) {
    if (c == 'r') res += p;
    if (c == 'p') res += s;
    if (c == 's') res += r;
  }
  foreach (i; 0 .. k) {
    char[] x;
    for (int j = i; j < n; j += k) x ~= z[j];
    debug stderr.writeln (x);
    char last = 0;
    foreach (o; 0 .. x.length) {
      if (last != x[o]) {
        upd (x[o]);
        last = x[o];
      } else {
        last = 0;
      }
    }
    debug stderr.writeln (res);
  }
  writeln (res);
}



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

int main()
{
	int h, w;
	cin >> h >> w;
	int c[10][10];

	rep(i, 10){
		rep(j, 10){
			scanf("%d", &c[i][j]);
		}
	}

	rep(i, 10){
		rep(j, 10){
			rep(k, 10){
				c[j][k] = min(c[j][k], c[j][i]+ c[i][k]);
			}
		}
	}

	// int a[h][n];
	int tmp;
	int sum = 0;
	rep(i, h){
		rep(j, w){
			scanf("%d", &tmp);
			if(tmp == -1) continue;
			
			sum += c[tmp][1];
		}
	}

	cout << sum << endl;
}



Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N,K;
    cin >> N >> K;
    vl P(N),C(N);
    rep(i,N){
        cin >> P[i];
        P[i]--;
    }
    rep(i,N){
        cin >> C[i];
    }
    ll ans=-INF;
    rep(i,N){
        ll loop_count=0;
        ll now=i;
        ll sum=0;
        while(loop_count==0||now!=i){
            sum+=C[now];
            now=P[now];
            loop_count++;
        }
        ll time=(K-1)/loop_count;
        ll plus=(K-1)%loop_count+1;
        ll MX=-INF,loop_MX=-INF;
        ll nowsum=0;now=i;
        //cout << plus << endl;
        rep(j,min(K,loop_count)){
            nowsum+=C[now];
            if(j<plus){
                chmax(loop_MX,nowsum);
            }
            chmax(MX,nowsum);
            now=P[now];
        }
        //cout << loop_count << endl;
        //cout << sum << endl;
        //cout << i << ' ' << MX << ' ' << time << ' ' << plus << endl;
        chmax(ans,max({time*sum+loop_MX,loop_MX}));
        //cout << loop_MX << endl;
        //cout << ans << endl;
        if(time>0){
            chmax(ans,max(MX,(time-1)*sum+MX));
            //cout << ans << endl;
        }
    }
    cout << ans << endl;
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/


Measured memory_bytes: 3732
a, b, c, d, e, k = int(input()), int(input()), int(input()), int(input()), int(input()), int(input())
distancies = {
    "a_b": b - a,
    "a_c": c - a,
    "a_d": d - a,
    "a_e": e - a,
    "b_c": c - b,
    "b_d": d - b,
    "b_e": e - b,
    "c_d": d - c,
    "c_e": e - c,
    "d_e": e - d
}
print("Yay!") if all(v <= k for v in distancies.values()) else print(":(")

Measured memory_bytes: 3064
import bisect

ans = "IMPOSSIBLE"
n, m = map(int, input().split())
ac = []
bc = []
for _ in range(m):
    a, b = map(int, input().split())
    if min(a, b) == 1:
        ac.append(max(a, b))
    elif max(a, b) == n:
        bc.append(min(a, b))
ac = list(sorted(ac))
bc = list(sorted(bc))
for c in ac:
    i = bisect.bisect_left(bc, c)
    if i < len(bc) and bc[i] == c:
        ans = ans[2:]
        break
print(ans)

Measured memory_bytes: 63064
def main():
    n = int(input())
    vs = sorted(map(int, input().split()))

    for i in range(len(vs)-1):
        if i == 0:
            ans = (vs[i] + vs[i+1])/2
        else:
            ans = (ans + (vs[i+1]))/2

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
object Main extends App {
  val Array(n,c,k) = readLine.split(" ").map{_.toInt}
  val t = (1 to n).map{_ => readInt}.toArray.sorted
  
  var ans = 0
  var i = 0
  var count = 0
  var time = 0
  
  while (i < n) {
    val now = t(i)
    ans += 1
    
    while (i < n && count < c && t(i)-now <= k) {
      count += 1
      i += 1
    }
    
    count = 0
  }
  
  println(ans)
}

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

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


Measured memory_bytes: 3604
#include <bits/stdc++.h>    
using namespace std;
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl "\n"
#define int long long 
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N          = 1000*100+5;
const ll N2      = 2000*1000*10;
const ld PI  = 3.14159265;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);} 
ll power(ll x,ll y,ll p = INF){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;} 
signed main()
{
    fastio();
    //cout<<fixed<<setprecision(20);
    //CHECK for LONG LONG and LONG DOUBLE
    /*comment for all except cc/cf    
    #ifndef ONLINE_JUDGE
           freopen("input.txt","r",stdin);
           freopen("output.txt","w",stdout);
    #endif//*/
    int n,m;
    cin>>n>>m;
    int a[n+5];
    int wax[n+5];
    fill(a,0);
    fill(wax,0);
    int ac = 0 , wa = 0;
    for (int i = 0; i < m; ++i)
    {
        int x;
        string y;
        cin>>x>>y;
        if(y=="AC")
        {
            if(!a[x])
            {
                a[x]++;
                wa+=wax[x];
                ac++;
            }
        }
        else
        {
            wax[x]++;
        }

    }
    cout<<ac<<" "<<wa;

    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;

ll dp[105][80000];
ll sdp[105][80000];

int main(int argc, char* argv[])
{
    int n, k;
    scanf("%d%d", &n, &k);

    int m = sqrt((double)n);
    vector<int> a;
    int i,j;
    for(i=0; i<m; i++) {
        a.push_back(i);
    }
    a.push_back(m);
    if(n/m>m) a.push_back(n/m);
    for(i=m-1; i>=1; i--) {
        a.push_back(n/i);
    }
    int nn=(int)a.size()-1;

    dp[0][0]=1;
    for(j=0; j<nn; j++) sdp[0][j+1]=1;
    for(i=1; i<=k; i++) {
        for(j=0; j<nn; j++) {
            dp[i][j]=sdp[i-1][nn-j];
            sdp[i][j+1]=(sdp[i][j] + dp[i][j] * (a[j+1]-a[j]))%MOD;
        }
    }
    printf("%lld\n", sdp[k][nn]);
    
    return 0;
}


Measured memory_bytes: 127228
#include<bits/stdc++.h>
#define MAXN 10000

using namespace std;
typedef long long ll;

int main()
{
	//freopen("t.txt","r",stdin);
	
	int n; 
	cin>>n;
	int a[100002];
	for (int i=1;i<=n;i++) cin>>a[i];
	int t=a[1],kq;
	for (int i=2;i<=n;i++){
		t=t^a[i]; 
	}
	if (t==0){
		cout<<"Yes";
		return 0;
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define two(a) (1<<(a))
#define LINF (1ll<<61)
#define EPS (1e-14)
#define Lshift(a,b) (a<<b)
#define Rshift(a,b) (a>>b)
#define rep(a,b) for(a=0 ; a<b ; a++)
#define xrep(a,b,c) for(a=b ; a<c ; a++)
#define INF (1<<29)
#define swap(a,b) ( (a^=b) , (b^=a) , (a^=b) )
#define GET(x) (mark[x>>5]>>(x&31)&1)
#define SET(x) (mark[x>>5]|=1<<(x&31))
#define maxL (10000000>>5)+1
#define mod 1000000007
#define vi vector<int>
#define pii pair<int, int>
#define mii map<int, int>
#define si set<int>
#define pb push_back
typedef long long ll;
using namespace std;

int f[100100], b[100100];
int p[100010];
int de[100010];
int groupSize[100100];

int root(int x) {
    if (p[x] == x) return x;
    p[x] = root(p[x]);
    return p[x];
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n, m, k, i;
    cin >> n >> m >> k;
    rep(i, n + 1) p[i] = i;
    int a, b, c, d;
    rep(i, m) {
        cin >> a >> b;
        de[a]++;
        de[b]++;
        int aa = root(a);
        int bb = root(b);
        if (aa != bb) {
            p[aa] = p[bb] = min(aa, bb);
        }
    }
    rep(i, k) {
        cin >> c >> d;
        int cc = root(c);
        int dd = root(d);
        if (cc == dd) {
            de[c]++;
            de[d]++;
        }            
    }
    xrep(i, 1, n + 1) {
        groupSize[root(i)]++;
    }
    xrep(i, 1, n + 1) {
        cout << groupSize[root(i)] - 1 - de[i] << ' ';
    }
    cout << endl;
}


Measured memory_bytes: 1920
#-*-coding:utf-8-*-

def main():
    #入力
    N = int(input())
    lists = list(map(int, input().split()))

    #変数
    max_element = 0
    min_element = lists[0]

    #各要素の差を求め前より大きかったらmax_elementに格納
    for i in range(N):
        if lists[i] > max_element:
            max_element = lists[i]
        if lists[i] < min_element:
            min_element = lists[i]

    print('{}'.format(max_element - min_element))

if __name__ == '__main__':
    main()

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

int main() {
  int N,M; cin >> N >> M;
  vector<int> a(max(N,M)),b(max(N,M)),road(max(N,M),0);
  
  for(int i=0;i < M;i++)
    cin >> a.at(i) >> b.at(i);
  
  for(int i=0;i < M;i++) {
    road.at(a.at(i)-1)++;
	road.at(b.at(i)-1)++;
  }
  
  for(int i=0;i < N;i++)
    cout << road.at(i) << endl;
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n;
int head[100100],to[200100],nxt[200100],deep[100100],size[100100],fa[100100],tot;
inline void add(int f,int t){to[++tot] = t;nxt[tot] = head[f];head[f] = tot;}
void dfs(int pos,int pre,int de)
{
	fa[pos] = pre;
	deep[pos] = de;
	for(int i = head[pos];i;i = nxt[i])
		if(to[i] != pre)
		{
			dfs(to[i],pos,de + 1);
			size[pos] += size[to[i]];
		}
	size[pos]++;
}
int main()
{
	scanf("%d",&n);
	for(int i = 1,a,b;i < n;i++)
	{
		scanf("%d%d",&a,&b);
		add(a,b),add(b,a);
	}
	dfs(1,0,0);
	int tmpdeep = deep[n] / 2 + 1;
	for(int i = n;;i = fa[i])
	{
		if(deep[i] == tmpdeep)
		{
			if(n - size[i] > size[i])//xw
				printf("Fennec\n");
			else//hw
				printf("Snuke\n");
			return 0;
		}
	}
}

Measured memory_bytes: 7936
#pragma GCC optimize("Ofast,fast-math,unroll-loops")

#include <bits/stdc++.h>

//#define ll ll
//#define double long double
#define endl '\n'
#define all(C) (C).begin(), (C).end()
#define rall(C) (C).rbegin(), (C).rend()
#define mp make_pair 
#define pb emplace_back
#define dbg(x) cerr << #x << " : " << x << endl
//#define PI 3.141592653589

using namespace std;
       
using ll = long long;
using ull = unsigned long long;
using ld = long double;
       
/* 
const ll MAX_MEM = 25e7;
char MEM[MAX_MEM];
ll MEM_POS = 0;
void* operator new(size_t x)
{
    auto ret = MEM + MEM_POS;
    MEM_POS += x;
    assert(MEM_POS < MAX_MEM);
    return ret;
}
void operator delete(void*)
{}
*/
       
template <class T>
istream& operator>> (istream &in, vector <T> &a)
{
    for (auto &i : a)
        in >> i;
    return in;
}
       
template <class T> 
ostream& operator<< (ostream &out, vector <T> a)
{
    for (auto &i : a)
        out << i << ' ';
    return out;
}
       
template <class T, class U>
istream& operator>> (istream &in, pair <T, U> &p)
{
    in >> p.first >> p.second;
    return in;
}
       
template <class T, class U>
ostream& operator<< (ostream &out, pair <T, U> p)
{
    out << p.first << " " << p.second << " ";
    return out;
}
       
inline void Start()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    //freopen("circlecover.in", "r", stdin);
    //freopen("circlecover.out", "w", stdout);
}

signed main()
{
    Start();
    int n, m;
    cin >> n >> m;
    int ac = 0, penal = 0;
    map <int, int> num;
    for (int i = 0; i < m; ++i)
    {
        int p;
        string s;
        cin >> p >> s;
        if (num[p] == -1)
            continue;
        if (s == "AC")
        {
            penal += num[p];
            num[p] = -1;
            ac++;
        }
        else
        {
            num[p]++;
        }
    }
    cout << ac << " " << penal;
    return 0;
}



Measured memory_bytes: 4992
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
const ll MOD = 998244353;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

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

	if (N % 2 == 0) {
		vector <pii> Va;
		for (int i = 1; i <= N; i++) {
			for (int j = i+1; j <= N; j++) {
				if (i == j || i + j == N + 1) continue;
				Va.emplace_back(i, j);
			}
		}
		printf("%d\n", (int)Va.size());
		for (auto it : Va) printf("%d %d\n", it.first, it.second);
	}
	else {
		vector <pii> Va;
		for (int i = 1; i <= N; i++) {
			for (int j = i + 1; j <= N; j++) {
				if (i == N || j == N);
				else if (i + j == N) continue;
				Va.emplace_back(i, j);
			}
		}
		printf("%d\n", (int)Va.size());
		for (auto it : Va) printf("%d %d\n", it.first, it.second);
	}
	return 0;
}

Measured memory_bytes: 384
import Control.Monad (replicateM)
import Data.List

main :: IO ()
main = do
  n <- (read :: String -> Int) <$> getLine
  sps <- zipWith (\k (a,b) -> (k,a,b)) ([1..] :: [Int]) . map ((\[a,b] -> (a,read b) :: (String, Int)) . words) <$> getNLine_ n
  mapM_ print . map (\(a,b,c) -> a) $ sortBy (\(_,b,c) (_,q,r) -> mappend (compare b q) (compare r c)) sps

getNLine_ :: Int -> IO [String]
getNLine_ n = replicateM n getLine

Measured memory_bytes: 1020
x, y = map(int, input().split(' '))

def gcd(x1,x2):
    if(x2 == 0):
        return x1
    else:
        return gcd(x2, x1 % x2)
    
if(x>=y):
    print(gcd(x,y))
else:
    print(gcd(y,x))


Measured memory_bytes: 5596
#include <iostream>
using namespace std;
int main(){
    int n;
    cin>>n;
    for(int i = 1;i<n+1;i++){
        int x = i;
        if(x % 3 == 0){
            cout<<" "<<i;
        }else{
            while(x > 0){
                if(x % 10 == 3){
                   cout<<" "<<i; 
                   x = 0;
                }else{
                    x = x/10;
                }
            }
            
        }
      if(i == n){
          cout<<""<<endl;
      } 
    }
    return 0;
}


Measured memory_bytes: 3092