akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,int> pii;
const int N = 5e4+5;
const int M = 5*1e5+5;
#define pi acos(-1)
#define INF 1e18
#define INM INT_MIN
#define pb(a)  push_back(a)
#define mk(a,b) make_pair(a,b)
#define dbg(x) cout << "now this num is " << x << endl;
#define met0(axx) memset(axx,0,sizeof(axx));
#define metf(axx) memset(axx,-1,sizeof(axx));
#define sd(ax) scanf("%d",&ax)
#define sld(ax) scanf("%lld",&ax)
#define sldd(ax,bx) scanf("%lld %lld",&ax,&bx)
#define sdd(ax,bx) scanf("%d %d",&ax,&bx)
#define sddd(ax,bx,cx) scanf("%d %d %d",&ax,&bx,&cx)
#define sfd(ax) scanf("%lf",&ax)
#define sfdd(ax,bx) scanf("%lf %lf",&ax,&bx)
#define pr(a) printf("%d\n",a)
#define plr(a) printf("%lld\n",a)
int main()
{
	int a,b,c,d,f = 0;cin >> a >> b >> c >> d;
	while(1)
	{
		c -= b;
		if(c <= 0) break;
		a -= d;
		if(a <= 0) break;
	}
	if(c <= 0) printf("Yes\n");
	else printf("No\n");
	//system("pause");
	return 0;
}

Measured memory_bytes: 3636
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		Map<String, Long> map = new HashMap<>();
		long cnt = 0;

		for ( int i = 0; i < n; i++ ) {
			char[] s = in.next().toCharArray();
			Arrays.sort(s);
			String key = new String(s);

			if(map.containsKey(key)) {
				cnt += map.get(key);
				map.put(key, map.get(key) + 1);
			}else {
				map.put(key, (long) 1);
			}			
		}

//		for ( Entry<String, Long> en : map.entrySet() ) {
//			// System.out.println(en);
//			cnt += nCr(en.getValue(), 2);
//		} 

		System.out.println(cnt);
		in.close();
	}
	
	private static long nCr(long n, long r) {
		if ( r == 0 ) return 1;
		return n * nCr(n - 1, r - 1) / r;
	}
}


Measured memory_bytes: 52180
#!/usr/bin/env python3
# coding:utf-8
import math

def main():
    stdIn = int(input())
    stdOut = solve(stdIn)
    print(stdOut)


"""
方針
A * B + C = N を満たす正の整数の組の数を答える問題
掛け算から詰めていくのが良さそう
A <= Bに固定して、A == B なら +1, A != B なら +2するのがよさぞう
CはA * Bの値によって一意に定められる

"""


def solve(n):
    pattern = 0
    a = 1
    while a < n:
        # C >= 1なので、a * b = n は不適
        patternB =  math.ceil(n / a) - 1 
        pattern += patternB
        a += 1
    return pattern


if __name__ == "__main__":
    main()


Measured memory_bytes: 9100
#include <bits/stdc++.h>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long LL;
typedef unsigned long long uLL;
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
LL z = 1;
int read(){
	int x, f = 1;
	char ch;
	while(ch = getchar(), ch < '0' || ch > '9') if(ch == '-') f = -1;
	x = ch - '0';
	while(ch = getchar(), ch >= '0' && ch <= '9') x = x * 10 + ch - 48;
	return x * f;
}
int ksm(int a, int b, int p){
	int s = 1;
	while(b){
		if(b & 1) s = z * s * a % p;
		a = z * a * a % p;
		b >>= 1;
	}
	return s;
}
int v[15], a[15];
char s[15];
int pd(int x){
	int i;
	while(x){
		i = x % 10;
		x /= 10;
		if(v[i]) return 0;
	}
	return 1;
}
int main(){
	int i, j, t, n, m, flag = 0, t1 = 0, t2 = 0;
	for(i = 1; i <= 3; i++){
		scanf("%d", &j);
		if(j == 5) t1++;
		if(j == 7) t2++;
	}
	if(t1 == 2 && t2 == 1) printf("YES");
	else printf("NO");
	return 0;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){
    int A,B,C; cin >> A >> B >> C;
    if(A==B) cout << C << endl;
    else if(B==C) cout << A << endl;
    else cout << B << endl;
    return 0;
}

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

using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;

const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;

#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORD(i, a, b) for (ll i = ll(b) - 1; i >= (a); i--)
#define TR(X)                                                  \
    ({                                                         \
        if (1) cerr << "TR: " << (#X) << " = " << (X) << endl; \
    })
#define LL(name) \
    ll name;     \
    cin >> name;
#define VL(name, num) \
    vl name(num);     \
    FOR(INPUT_VL_I, 0, num) { cin >> name[INPUT_VL_I]; }

constexpr ll MOD = 1000000007;

pll normalize(ll a, ll b) {
    if (a == 0 && b == 0) return {a, b};
    if (a == 0) return {0, 1};
    if (b == 0) return {1, 0};

    ll g = gcd(a, b);
    a /= g;
    b /= g;

    if (b < 0) {
        a = -a;
        b = -b;
    }

    return mp(a, b);
}

pll inverse(pll p) {
    if (p.xx == 0) return {1, 0};
    if (p.yy == 0) return {0, 1};

    p.xx *= -1;

    return normalize(p.yy, p.xx);
}

int main() {
    cin.sync_with_stdio(0);
    LL(N);

    map<pll, ll> cnt;

    FOR(i, 0, N) {
        ll a, b; cin >> a >> b;

        pll norm = normalize(a,b);
        cnt[norm] ++;
    }

    vl pows(N+1);
    pows[0] = 1;
    FOR(i, 1, N+1) {
        pows[i] = pows[i-1] * 2 % MOD;
    }

    ll ans = 1;
    for (auto entry : cnt) {
        pll norm;
        ll num;
        tie(norm, num) = entry;

        if (num == 0) continue;
        if (norm == mp(0ll,0ll)) continue;

        const ll inv_num = cnt[inverse(norm)];
        cnt[inverse(norm)] = 0;

        const ll factor = (pows[num] - 1 + pows[inv_num] - 1 + 1 + MOD) % MOD;
        ans = ans * factor % MOD;
    }

    cout << (ans - 1 + MOD + cnt[mp(0,0)]) % MOD << endl;
}  // cin.tie(0) bei schnellem Wechseln


Measured memory_bytes: 29648
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007
dire4 = [(1,0), (0,1), (-1,0), (0,-1)]
dire8 = [(1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)]

def bfs(c,sy=0, sx=0, gy=0, gx=0, blocks=['#'], dire=[(1,0), (0,1), (-1,0), (0,-1)], return_maximum_distance=False):
    H = len(c)
    W = len(c[0])
    distance_limit = H*W+1
    dist = [[distance_limit]*W for i in range(H)]

    q = deque()

    q_append = q.append
    q_popleft = q.popleft

    if (type(sy)==list) or (type(sx)==list):
        for syi, sxi in zip(sy, sx):
            dist[syi][sxi] = 0
            q.append((syi, sxi))
    else:
        dist[sy][sx] = 0
        q_append((sy, sx))

    while q:
        y, x = q_popleft()
        d = dist[y][x]
        for dy, dx in dire:
            if (y+dy<H) and (y+dy>=0) and (x+dx<W) and (x+dx>=0):
                if (c[y+dy][x+dx] in blocks):
                    continue
                else:
                    if (y+dy==gy) and (x+dx==gx) and (not return_maximum_distance):
                        return (d+1)
                    elif (dist[y+dy][x+dx] > d+1):
                        dist[y+dy][x+dx] = d+1
                        q_append((y+dy, x+dx))
    if (return_maximum_distance):
        return d
    return -1

H, W = LI()
c = SR(H)

sy = []
sx = []

for i in range(H):
    for j in range(W):
        if (c[i][j]=="#"):
            sy.append(i)
            sx.append(j)

print(bfs(c, sy, sx, return_maximum_distance=True))


Measured memory_bytes: 139596
#include <bits/stdc++.h>                                                        
using namespace std;                                                            
                                                                                
int main(){                                                                     
                                                                                
        double r,c;                                                             
        cout.precision(20);                                                     
        cin >> r;                                                               
        c = 2*M_PI*r;                                                           
        cout << c;                                                              
        return 0;                                                               
}  

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

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

    bool ok = true;
    for(int i=0; i<S.size(); i++){
        if(S[i] != S[S.size()-1-i]){
            ok = false;
        }
    }

    for(int i=0; i<(S.size()-1)/2; i++){
        if(S[i] != S[(S.size()-1)/2-i-1]){
            ok = false;
        }
    }

    for(int i=(S.size()+3)/2-1; i<S.size(); i++){
        if(S[i] != S[S.size()-i-1]){
            ok = false;
        }
    }

    cout << (ok ? "Yes" : "No") << endl;
}

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

int main() {
  string n;
  cin >> n;
  string ans = "No";
  for (char c : n) {
    if (c == '9') {
      ans = "Yes";
      break;
    }
  }
  cout << ans << endl;
  return 0; 
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
// clang-format on

namespace libgraph {
  using Weight = int;
  struct Edge {
    int src, dst;
    Weight weight;
    Edge(const int &s = 0, const int &d = 0, const Weight &w = 0)
      : src(s), dst(d), weight(w) {
    }
  };

  using Edges  = std::vector<Edge>;
  using Array  = std::vector<Weight>;
  using Matrix = std::vector<Array>;

  class Graph {
    std::vector<Edges> g;

  public:
    Graph(const int &size = 0)
      : g(size) {
    }

    void addArc(const int &src, const int &dst, const Weight &w = 1) {
      g[src].emplace_back(src, dst, w);
    }

    void addEdge(const int &node1, const int &node2, const Weight &w = 1) {
      addArc(node1, node2, w);
      addArc(node2, node1, w);
    }

    std::vector<Weight> dijkstra(const int &src, const int &inf = std::numeric_limits<Weight>::max() / 8) {
      using state = std::pair<Weight, int>;
      std::priority_queue<state, std::vector<state>, std::greater<state>> q;
      std::vector<Weight> dist(g.size(), INF);
      dist[src] = 0;
      q.emplace(0, src);
      while (q.size()) {
        Weight d;
        int v;
        std::tie(d, v) = q.top();
        q.pop();
        if (dist[v] < d) continue;
        for (auto &e : g[v]) {
          if (dist[e.dst] > dist[v] + e.weight) {
            dist[e.dst] = dist[v] + e.weight;
            q.emplace(dist[e.dst], e.dst);
          }
        }
      }
      return dist;
    }
  };
}
using namespace libgraph;

main {
  int v, e, r;
  cin >> v >> e >> r;
  Graph g(v);
  while (e--) {
    int s, t, d;
    cin >> s >> t >> d;
    g.addArc(s, t, d);
  }
  vector<Weight> dist = g.dijkstra(r, INF);
  rep(i, dist.size()) cout << (dist[i] == INF ? "INF" : to_string(dist[i])) << endl;
}

Measured memory_bytes: 24352
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include <unordered_map>
#include<list>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<cmath>
 
#define rep(i,x) for(int i=0;i<(int)(x);i++)
#define reps(i,x) for(int i=1;i<=(int)(x);i++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(int i=((int)(x));i>0;i--)
 
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define INF 2e10
 
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; }
typedef long long ll;
typedef std::pair<ll, ll> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
 
using namespace std;

int main()
{
    ll n;
    cin >> n;
    ll p1 = 0;
    ll cnt = 0;
    rep(i, n){
        ll now;
        cin >> now;
        if(now > p1) cnt = 0;
        else cnt += p1 - now;

        if(cnt >= 2){
            cout << "No" << endl;
            return 0;
        }
        p1 = now;
    }
    cout << "Yes";
}

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

int main(){
    int n; cin >> n;
    map<ll, ll> m; 
    for(int i = 0; i < n; i++){
        ll a; cin >> a;
        m[a]++;
        if(m[a] == 2){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 12800
<?php
	list( $n, $m, $l ) = explode( ' ', trim( fgets( STDIN ) ) );
	$A = array();
	$B = array();
	$C = array_fill( 0, $n, array_fill( 0, $l, 0 ) );
	for( $i=0; $i<$n; $i++ ) {
		array_push( $A, explode( ' ', trim( fgets( STDIN ) ) ) );
	}
	for( $i=0; $i<$m; $i++ ) {
		array_push( $B, explode( ' ', trim( fgets( STDIN ) ) ) );
	}
	for( $i=0; $i<$n; $i++ ) {
		for( $k=0; $k<$m; $k++ ) {
			for( $j=0; $j<$l; $j++ ) {
				$C[$i][$j] += $A[$i][$k]*$B[$k][$j];
			}
		}
	}
	for( $i=0; $i<$n; $i++ ) {
		print implode( " ", $C[$i] ).PHP_EOL;
	}
	return;
?>

Measured memory_bytes: 11608
#include <cstdio>
#include <algorithm>	
#include <iostream>
#include <vector>
#include <queue>
#include <cstring>
#include <cmath>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long LL;
typedef unsigned int uii;
typedef pair<int,int> pii;
typedef unsigned long long uLL; 
typedef vector<int> vi; 



int main(int argc, char const *argv[])
{
#ifndef ONLINE_JUDGE
	// freopen("out.txt", "w", stdout);
#endif
	long long a, b;
	cin >> a >> b;
	cout << a * b / __gcd(a, b) << endl;
	return 0;
}

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

int main()
{
    string O, E;
    cin >> O >> E;
    for (int i = 0; i < O.size(); ++i){
        cout << O[i];
        if( i<E.size() ){
            cout << E[i];
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace kyoupuro {

    class MainClass {

        public static void Main() {
            var N = Input.NextInt();
            var A = Input.NextInt();
            var list = Input.IntList();
            var dp = new long[N + 1, N + 1, 5000]; // inputの順番, 枚数, 合計

            dp[0, 0, 0] = 1;

            for (int i = 0; i < N; i++) {
                for (int j = 0; j < N; j++) {
                    for (int sum = 0; sum < 4000; sum++) {
                        dp[i + 1, j, sum] += dp[i, j, sum];
                        dp[i + 1, j + 1, sum + list[i]] += dp[i, j, sum];
                    }
                }
            }

            long count = 0;
            for (int i = 1; i <= N; i++) {
                count += dp[N, i, i * A];
            }
            Console.WriteLine(count);
        }
    }

    class Input {
        static IEnumerator<string> enumerator;

        public static string Line() {
            return Console.ReadLine();
        }

        public static int NextInt() {
            if (enumerator == null || !enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
                enumerator.MoveNext();
            }
            return int.Parse(enumerator.Current);
        }

        public static long NextLong() {
            if (enumerator == null || !enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
                enumerator.MoveNext();
            }
            return long.Parse(enumerator.Current);
        }

        public static string[] StrArr() {
            return Line().Split(' ');
        }

        public static List<int> IntList() {
            return StrArr().Select(int.Parse).ToList();
        }

        public static List<long> LongList() {
            return StrArr().Select(long.Parse).ToList();
        }

        public static void Skip(int line = 1) {
            enumerator.Reset();
            for (int i = 0; i < line; i++) Console.ReadLine();
        }

        public static void Reset() {
            enumerator.Reset();
        }
    }
}

Measured memory_bytes: 111456
#include <iostream>
using namespace std;
int main(){
  	cin.tie(0);
  	ios::sync_with_stdio(false);
    int D, G, p[11], c[11];
    cin >> D >> G;
    for(int i = 0; i < D; ++i){
        cin >> p[i] >> c[i];
    }

    int ans = 1e9;
    for(int mask = 0; mask < (1 << D); ++mask){
        int s = 0, num = 0, rest_max = -1;
        for(int i = 0; i < D; ++i){
            if(mask >> i & 1){
                s += 100 * (i+1) * p[i] + c[i];
                num += p[i];
            }else{
                rest_max = i;
            }
        }
        if(s < G){
            int s1 = 100 * (rest_max + 1);
            int need = (G - s + s1 - 1) / s1;
            if(need >= p[rest_max]){
                continue;
            }
            num += need;
        }
        ans = min(ans, num);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>
using namespace std;
set<int> c;
int main() {
    int a, b;
    
    c.insert(1);
    c.insert(2);
    c.insert(3);
    cin >> a;
    cin >> b;
    c.erase(a);
    c.erase(b);
    for(auto x : c) {
        cout << x << endl;     // 要素を順に表示
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
    int a,b;
    cin>>a>>b;
    if(a>=1&&a<=9&&b>=1&&b<=9){
        cout<<a*b<<endl;
    }
    else{
        cout<<-1<<endl;
    }
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Main p = new Main();
	}

	public Main() {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int n = sc.nextInt();
			if(n==0) break;
			@SuppressWarnings("unchecked")
			ArrayList<Integer>[] l = new ArrayList[30];
			for(int i=0;i<30;i++)
				l[i] = new ArrayList<Integer>();
			
			for(int i=0;i<n;i++){
				int m = sc.nextInt();
				for(int j=0;j<m;j++){
					int d = sc.nextInt()-1;
					l[d].add(i);
				}
			}
			solve(n, l);
		}
	}

	public void solve(int n, ArrayList<Integer>[] l) {
		long[] have = new long[n];
		for(int i=0;i<n;i++){
			have[i] |= (1L<<i);
		}
		int res = -1;
		long ok = (1L<<n)-1;
		for(int i=0;i<l.length;i++){
			for(int j=0;j<l[i].size();j++){
				for(int k=j+1;k<l[i].size();k++){
					int p1 = l[i].get(j);
					int p2 = l[i].get(k);
					have[p1] |= have[p2];
					have[p2] |= have[p1];
				}
			}
			for(int j=0;j<n;j++){
				if(have[j]==ok){
					res = i+1;
					break;
				}
			}
			if(res!=-1)
				break;
		}
		System.out.println(res);
	}

}

Measured memory_bytes: 93740
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
 
#define pb push_back
#define mp make_pair

typedef long long ll; 

#define fi first
#define se second
 
#define all(x) (x).begin(), (x).end()
 
using namespace std;             
//using namespace __gnu_pbds;
 
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int INF = (int)1e10;                   

void solve() {                           
    int n;
    cin >> n;
    vector<int> a(n);int ans = 0, mx = 0;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        mx = max(mx, a[i]);
        ans += (mx <= a[i]);
    }
    cout << ans;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int tt = 1;
 
    while (tt--) {
        solve();
    }
 
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

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

	int n;
	cin >> n;

	vector<int> a(n);
	int multiples = 0, duos = 0;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		if (a[i] % 4 == 0) {
			++multiples;
		}
		else if (a[i] % 2 == 0) {
			++duos;
		}
	}

	bool valid = true;
	for (int i = 0; i < n - 1; ++i) {
		if (a[i] * a[i + 1] % 4 != 0) {
			valid = false;
			break;
		}
	}

	if (valid) {
		cout << "Yes\n";
		return 0;
	}

	int used_duos = duos / 2 * 2;
	if (multiples >= (n - used_duos) / 2) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}

	return 0;

}

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

using namespace std;

string reverse(string old) {
	string rev;
	for (string::reverse_iterator rit = old.rbegin(); rit != old.rend(); ++rit) {
		rev += *rit;
	}
	return rev;
}

int main() {
	string oldF;
	vector<string> newF;
	int n;
	string tmpF1, tmpF2, tmpF;
	int ans;
	
	cin >> n;
	for (int i = 0; i < n; i++) {
		ans = 0;
		newF.clear();
		cin >> oldF;
		for (int j = 1; j < oldF.length(); j++) {
			tmpF1 = oldF.substr(0, j);
			tmpF2 = oldF.substr(j);
			//cout << tmpF1 << " " << tmpF2 << endl;
			//cout << reverse(tmpF1) << endl;
			// 1.1+2
			tmpF = tmpF1;
			tmpF += tmpF2;
			newF.push_back(tmpF);
			
			// 2.1+2r
			tmpF = tmpF1;
			tmpF += reverse(tmpF2);
			newF.push_back(tmpF);

			// 3.1r+2
			tmpF = reverse(tmpF1);
			tmpF += tmpF2;
			newF.push_back(tmpF);

			// 4.1r+2r
			tmpF = reverse(tmpF1);
			tmpF += reverse(tmpF2);
			newF.push_back(tmpF);

			// 5.2+1
			tmpF = tmpF2;
			tmpF += tmpF1;
			newF.push_back(tmpF);

			// 6.2+1r
			tmpF = tmpF2;
			tmpF += reverse(tmpF1);
			newF.push_back(tmpF);
			
			// 7.2r+1
			tmpF = reverse(tmpF2);
			tmpF += tmpF1;
			newF.push_back(tmpF);

			// 8.2r+1r
			tmpF = reverse(tmpF2);
			tmpF += reverse(tmpF1);
			newF.push_back(tmpF);
			//for (int k = 0; k < newF.size(); k++) {
			//cout << newF[k] << endl;
			//}
		}
		ans++;
		for (int j = 1; j < newF.size(); j++) {
			ans++;
			for (int k = 0; k < j; k++) {
				if (newF[k] == newF[j]) {
					ans--;
					break;
				}
			}
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1348
#include<cstdio>
#include<algorithm>
#include<cstring>
#define mp make_pair
typedef long long ll;
using namespace std;
ll dp[5010],cnt=0;
int n,p,a[100];
int main(){
	scanf("%d%d",&n,&p);
	for (int i=1; i<=n; i++) scanf("%d",&a[i]); dp[0]=1;
	for (int i=1; i<=n; i++)
		for (int j=5000; j>=a[i]; j--)
			dp[j]+=dp[j-a[i]];
	for (int i=0; i<=5000; i++)
		if (i%2 ==p ) cnt+=dp[i];
	printf("%lld\n",cnt);
	return 0; 
			
}

Measured memory_bytes: 256
/*
 * 	Heart beats fast
 * 		Colors and promises
 * 			How to be brave
 * 				How can I love when I am afraid to fall...
*/
#include<bits/stdc++.h>
// #include<boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
using namespace std;
#define int long long
#define mod 1000000007
#define FAST ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f(i,n) for(int i=0;i<n;i++)
#define fp(i,k,n) for(int i=k;i<=n;i++)
#define fr(i,k,n) for(int i=k;i>=n;i--)
#define pb push_back
#define F first
#define S second

void solve()
{
  int n,p;
  cin >> n >> p;
  string s;
  cin >> s;
  if(p == 2 || p == 5){
			int ans = 0;
			for(int i = 0; i < n; i++){
				if((s[i] - '0') % p == 0)
					ans += i + 1;
			}
			cout << ans;
			return ;
		}
  int cnt=0,r=0;
  map<int,int> m;
  m[0]=1;
  int q=1;
  fr(i,n-1,0)
  {
    r=((s[i]-'0')*q +r)%p;
    q*=10;
    q%=p;
    cnt+=m[r];
    m[r]++;
  }
  cout << cnt ;
  return;
}

signed main()
{
  FAST;
	int T=1;
	// cin >> T;
	while(T--)
	{
		solve();
	}
    return 0;
}

Measured memory_bytes: 1044
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define vv vector<lli>
#define vp vector<pair<lli,lli>>
#define vpp vector<pair<lli,pair<lli,lli>>>
#define lims(w) (w).begin(),(w).end()
#define rlims(w) (w).rbegin(),(w).rend()
#define pb push_back
#define mp make_pair
#define f(i,a,b) for(lli i=a;i<b;i++)
#define ff first
#define ss second
#define sz(a) (lli)(a.size())
lli inf = (1e18 + 2);

int main()
{
	string s;
	string t;
	cin>>s;
	cin>>t;
	lli ctr = 0;
	lli minn = inf;
	lli n = s.length();
	lli m = t.length();

	f(i,0,n-m+1)
	{
		ctr = 0;

		f(j,i,i+m)
		{
			if(s[j] != t[j-i])
				ctr++;
		}

		minn = min(ctr, minn);
	}

	cout<<minn<<endl;
	return 0;
}


Measured memory_bytes: 3624
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size)
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using lint = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main()
{
  int n; cin >> n;
  vector<int> w(n,0);
  rep(i,n) cin >> w[i];
      int dif = 1000001; 
  for(int i = 1;i<n;i++){
    int former=0;
    int latter =0;
    rep(j,i) former += w[j];
    for(int j=i;j<n;j++) latter += w[j];
    //cout << former << endl << latter <<endl;

    chmin(dif,abs(former-latter));
  }
  cout << dif << endl;
    return 0;
}

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

int main()
{
  ll n;
  cin>>n;
  vector<ll>a(n);
  map<ll, ll>m;
  for(ll i=0;i<n;i++) cin>>a[i];
  for(ll i=0;i<n;i++)
    m[a[i]]++;
  if(m.size()==n)
    cout<<"YES";
  else
    cout<<"NO";
  return 0;
}

Measured memory_bytes: 14336
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};

fn main() {
    let a: i64 = read();
    let b: i64 = read();
    let h: f64 = read();
    let m: f64 = read();
    let mut ans: f64 = 0.0;

    let ha = h * 30_f64 + 30_f64 * (m / 60_f64);
    let ma = m * 6_f64;
    // let sita_angle: f64 = min((ha - ma).abs(), 360 - (ha - ma).abs()) as f64;
    let site_angle = (ha - ma).abs();
    // println!("{}", site_angle);
    let sita = (site_angle / 180.0 as f64) * std::f64::consts::PI;
    let sitacos = sita.cos();
    let a2b2 = a * a + b * b;
    let sab = 2 * a * b;
    // println!("{}", a2b2);
    // println!("{}", sab);
    // println!("{}", sitacos);
    println!("{}", (a2b2 as f64 - (sab as f64 * sitacos)).sqrt());
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

int main() {
    int N, M;
    cin >> N >> M;
    vector<ll> X(M);
    rep(i, M) cin >> X[i];
    sort(X.begin(), X.end());

    vector<ll> D(M - 1);
    rep(i, M - 1) D[i] = (X[i + 1] - X[i]);
    sort(D.begin(), D.end());

    ll ans = 0;
    rep(i, max(M - 1 - (N - 1), 0)) ans += D[i];
    cout << ans << endl;
}


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

int main() {
  for (;;) {
    int x, y;
    cin >> x >> y;

    if (x == 0 && y == 0)
      return 0;

    if (x > y)
      swap(x, y);
    cout << x << " " << y << endl;
  }
}


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

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;

const int N = 60, mod = 1e9 + 7;

int n;
int res[N];
int str[N][N];

int main()
{
    scanf("%d", &n);
    for(int i = 0; i < n; i++)
    {
        char t[60];
        scanf("%s", t);
        int len = strlen(t);

        for(int j = 0; j < len; j++)
            str[i][t[j] - 'a']++;
    }

    for(int i = 0; i < 26; i++)
    {
        int cnt = 0x3f3f3f3f;
        for(int j = 0; j < n; j++) cnt = min(cnt, str[j][i]);
        res[i] = cnt;
    }

    for(int i = 0; i < 26; i++)
        for(int j = 0; j < res[i]; j++)
            printf("%c", i + 'a');

    puts("");

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.lang.Math;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int n = sc.nextInt();
        int a[] = new int[w];
        for(int i=0;i<a.length;i++){
            a[i] = i+1;
        }
        
        int x,y,z;
        for(int i=0;i<n;i++){
            String s = sc.next();
            String[] s1 = s.split(",");
            x = Integer.parseInt(s1[0])-1;
            y = Integer.parseInt(s1[1])-1;
            z = a[x];
            a[x]=a[y];
            a[y]=z;
        }
        for(int i=0;i<w;i++){
            System.out.println(a[i]);
        }
        sc.close();
    }
}


Measured memory_bytes: 26456
#include <stdio.h>

int main(void)
{
  int H, W;
  int i, j;

  while (1) {
    scanf("%d %d", &H, &W);

    if (H == 0 && W == 0) break;

    for (i = 0; i < H; i++) {
      for (j = 0; j < W; j++) {
        putchar('#');
      }

      putchar('\n');
    }

    putchar('\n');
  }

  return 0;
}

Measured memory_bytes: 572
#define _USE_MATH_DEFINES

#include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <bitset>

using namespace std;

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

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

const int Maxn = 100010;

P p[Maxn];

int n, m;

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

    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        p[i] = P(b - 1, a);
    }
    sort(p, p + m);
    int cur = 0, cnt = 0;
    for (int i = 0; i < m; ++i) {
        if (cur < p[i].second){
            ++cnt;
            cur = p[i].first;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const int sz=5e5+7;
const int mod=998244353;
int n,k;
int ans;
int fac[sz],ifac[sz],inv[sz];
void init(){
	fac[0]=ifac[0]=1;
	fac[1]=ifac[1]=inv[1]=1;
	for(int i=2;i<sz;i++){
		inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
		fac[i]=1ll*i*fac[i-1]%mod;
		ifac[i]=1ll*inv[i]*ifac[i-1]%mod;
	}
}
int C(int n,int m){
	if(n<m) return 0;
	return 1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}
int calc(int x,int y,int t){
	//长为x宽为y不经过y-x=t
	if(t<=0) return 0;
	int ret=0;
	ret=C(x+y,x);
	if(y>=t) ret=(ret+mod-C(x+y,y-t))%mod;
	return ret;
}
int main(){
	init();
	scanf("%d%d",&n,&k);
	for(int i=(k+1)/2;i<=k;i++){
		int j=k-i;
		if(i==j) ans+=calc(i,j-1,i-n+1);
		else ans+=calc(i,j,i-n+1);
		if(ans>=mod) ans-=mod;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 6144
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>

using namespace std;

//conversion
//------------------------------------------
inline long toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline long toLong(string s) {long v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const long double EPS = 1e-12;
const double INF = 1e9;

struct edge{int to,cost;};
typedef pair<int,int> P;//firstは最短距離,secondは頂点番号


int main(){
	int n;cin>>n;
	REP(i,n){
		
		int x;
		cin>>x;
		cout<<"Case "<<i+1<<":"<<endl;
		REP(j,10){
			string str=toString(x*x);
			string ans="";
			FOR(k,SZ(str),8)ans+='0';
			ans+=str;
			x=toInt(ans.substr(2,4));
			cout<<x<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1232
// https://atcoder.jp/contests/arc062/tasks/arc062_b
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int cnt = count(ALL(s), 'p');
    int len = s.length();
    cout << len / 2 - cnt << endl;

    return 0;
}


Measured memory_bytes: 512
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
d, n = map(int, input().split())
if d == 0:
    cnt = 0
    for i in range(10**10):
        if i % 100 != 0:
            cnt += 1
            if cnt == n:
                print(i)
                exit()
if d == 1:
    if n == 100:
        print(101*100)
        exit()
    cnt = 0
    for i in range(100, 10**12):
        if i % 100 == 0:
            cnt += 1
            if cnt == n:
                print(i)
                exit()

if d == 2:
    if n == 100:
        print(101*100*100)
        exit()
    cnt = 0
    for i in range(10000, 10**12):
        if i % 10000 == 0:
            cnt += 1
            if cnt == n:
                print(i)
                exit()


Measured memory_bytes: 61672
using System;
using System.Linq;
using System.Collections.Generic;

namespace ABC
{
    class ProgramA
    {
        static void Main(string[] args)
        {
            var a = long.Parse(Console.ReadLine());

            var result = 0;

            if (a < 600)
                result = 8;
            else if (a < 800)
                result = 7;
            else if (a < 1000)
                result = 6;
            else if (a < 1200)
                result = 5;
            else if (a < 1400)
                result = 4;
            else if (a < 1600)
                result = 3;
            else if (a < 1800)
                result = 2;
            else if (a < 2000)
                result = 1;



            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 27536
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

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


	int N;
	cin >> N;

	int M = N / 1.08;

	int OK = 0;
	if (int(M++ * 1.08) == N) OK = 1;
	if (int(M++ * 1.08) == N) OK = 2;
	if (int(M++ * 1.08) == N) OK = 3;

	if (OK == 0) co(":(");
	else {
		co(M + OK - 4);
	}

	Would you please return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cassert>
#include<cstdlib>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<vector>
#include<bitset>
using namespace std;
#define pb push_back
#define x0 fuckcjb
#define x1 fuckshb
#define y0 fucksub
#define y1 fuckjtjl
int lastx,lasty,last,t,x,y,n;
int main()
{
	scanf("%d",&n);
	last=lastx=lasty=0;
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d%d",&t,&x,&y);
		int dt=t-last,dd=abs(x-lastx)+abs(y-lasty);
		if(dt<dd||(dt-dd)%2==1)
		{
			puts("No");
			return 0;
		}
		last=t;lastx=x;lasty=y;
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n);++i)
const int INF =1001001001;
using ll=long long;
using P = pair<int,int>;
using Graph =vector<string>;
Graph field;
queue<P> q;

int main() {
  ll a,b,c,d,e,n;
  cin>>n;
  a=0;
  b=0;
  rep(i,n){
    ll ab,ac;
    cin>>ab>>ac;
    if(ab==ac){
      a++;
    }else{
      a=0;
    }
    if(a==3){
      b=1;
    }
  }
  if(b){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}



Measured memory_bytes: 3632
#include<stdio.h>
#include<string.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef vector<int>vec;
typedef vector<vec>mat;
int N,M,A,B,C,T;

mat mat_mul(mat &A,mat &B)
{
	mat C(A.size(),vec(B[0].size()));
	for(int i=0;i<A.size();i++)
		for(int k=0;k<B.size();k++)
			for(int j=0;j<B[0].size();j++)
				C[i][j]=(C[i][j]+A[i][k]*B[k][j])%M;
	return C;
}


mat mod_pow(mat A,int N)
{
	mat B(A.size(),vec(A.size()));
	for(int i=0;i<A.size();i++)
		B[i][i]=1;
	while(N>0)
	{
		if(N&1)
			B=mat_mul(B,A);
		A=mat_mul(A,A);
		N>>=1;
	}
	return B;
}

int main()
{
	for(;scanf("%d%d%d%d%d%d",&N,&M,&A,&B,&C,&T),N;)
	{
		mat X(N,vec(N));
		mat Y(N,vec(N));
		for(int i=0;i<N;i++)
			scanf("%d",&X[i][0]);
		for(int i=0;i<N;i++)
		{
			if(i-1>=0)Y[i][i-1]=A;
			Y[i][i]=B;
			if(i+1<N)Y[i][i+1]=C;
		}
		mat Z=mod_pow(Y,T);
		mat R=mat_mul(Z,X);
		for(int i=0;i<N;i++)
			printf("%d%s",T==0?X[i][0]:R[i][0],i==N-1?"\n":" ");
	}
	return 0;
}

Measured memory_bytes: 1116
#include <iostream>
#include <string>
#include <sstream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
using namespace std;
int i,j,k,n,m;
string s;

int main() {
  long t;cin>>n>>t;
  vector<long> vt(n), vdt(n);
  for(i=0;i<n;++i) cin>>vt[i];
  long tot=0;
  for(j=0;j<n-1;++j) tot += min(t,vt[j+1]-vt[j]);
  tot += t;
  cout << tot << endl;
  return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
int main() {
  string w;
  cin >> w;
  vector<int> A(26);
  bool ans = true;
  for (int i = 0; i < w.size(); i++) {
    A[w[i] - 97]++;
  }
  for (int i = 0; i < 26; i++) {
    if (A[i] % 2 == 1) {
      ans = false;
    }
  }
  if (ans) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 384
import random
D = int(input())
c = list(map(int,input().split()))
s = []
for i in range(D):
    s.append(list(map(int,input().split())))
t = [1]*D
def my_index(l,x,d,default=False):
    if x in l:
        return l.index(x)
    else:
        return d
def last(d,i):
    a= t[:d]
    a.reverse()
    day = -1*(my_index(a,i,d))+d
    return day
score = 0
for i in range(40):
    score_v=0
    t_old = t
    d_change = random.randint(0,D-1)
    q_change = random.randint(1,26)
    t[d_change]=q_change
    for d in range(1,D+1):
        score_v += s[d-1][t[d-1]-1]
        for i in range(1,27):
            score_v -= c[i-1]*(d-last(d,i))
    if score_v>score:
        score=score_v
    else:
        t = t_old
for i in range(D):
    print(t[i])

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

int main() {
  string c;
  cin >> c;
  map<string, string> m;
  m["A"] = "T";
  m["T"] = "A";
  m["G"] = "C";
  m["C"] = "G";
  string ans = m[c];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3608
#include <stdio.h>

typedef struct {
	int n[6];
}dice;

int equal1(dice dx, dice dy)
{
	int i;
	for (i = 0; i < 6; i++)
		if (dx.n[i] != dy.n[i])
			return 0;
	return 1;
}

void rots(dice *d)
{
	dice temp;
	temp = *d;

	d->n[0] = temp.n[4];
	d->n[1] = temp.n[0];
	d->n[2] = temp.n[2];
	d->n[3] = temp.n[3];
	d->n[4] = temp.n[5];
	d->n[5] = temp.n[1];
}

void rotw(dice *d)
{
	dice temp;
	temp = *d;

	d->n[0] = temp.n[2];
	d->n[1] = temp.n[1];
	d->n[2] = temp.n[5];
	d->n[3] = temp.n[0];
	d->n[4] = temp.n[4];
	d->n[5] = temp.n[3];
}

int equal2(dice dx, dice dy)
{
	int i;
	dice temp;
	temp = dx;
	for (i = 0; i < 4; i++) {
		if (equal1(temp, dy)) return 1;
		rotw(&temp);
	}
	return 0;
}

int main(void)
{
	dice d[2];
	int i, j;

	for (i = 0; i < 2; i++)
		for (j = 0; j < 6; j++)
			scanf("%d", &d[i].n[j]);

	j = 0;

	for (i = 0; i < 32; i++) {
		if (equal2(d[0], d[1])) {
			j++;
			break;
		}
		rots(&d[0]);
		if (equal2(d[0], d[1])) {
			j++;
			break;
		}
		rots(&d[0]);
		if (equal2(d[0], d[1])) {
			j++;
			break;
		}
		rotw(&d[0]);
		rots(&d[0]);
		rotw(&d[0]);
		rotw(&d[0]);
		rotw(&d[0]);
	}

	if (j)
		printf("Yes\n");
	else
		printf("No\n");

	return 0;
}

Measured memory_bytes: 580
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <iterator>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(v) reverse((v).begin(),(v).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)

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

	int pa, pb, pc, a, b, c;
	cin >> pa >> pb >> pc;

	int ta, tb, tc;
	
	REP(i, n-1) {
		cin >> ta >> tb >> tc;
		a = max(pb, pc) + ta;
		b = max(pa, pc) + tb;
		c = max(pa, pb) + tc;

		pa = a;
		pb = b;
		pc = c;
	}

	int ans = max(pa, pb);
	ans = max(ans, pc);
	ANS(ans);


	return 0;
}


Measured memory_bytes: 256
Scanf.scanf "%d %s" (fun n s ->
    let rec loop i r =
        if i = n then r else
            if s.[i] = 'R' then loop (i + 1) (r + 1) else loop (i + 1) r
    in
    let r = loop 0 0 in

    let rec loop i leftw =
        if i = r then leftw else
            loop (i + 1) (if s.[i] = 'W' then leftw + 1 else leftw)
    in
    let leftw = loop 0 0 in
    Printf.printf "%d\n" leftw
)

Measured memory_bytes: 4560