akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define emp emplace
 
using namespace std;
using ll = long long;
using ii = pair<int, int>;
 
const int MOD = 1000 * 1000 * 1000 + 7;
const int N = 100000;
 
vector<int> adj[N];
ll dp[N][2];
bool visited[N];

void dfs(int n){
    visited[n] = true;

    for(auto child : adj[n]){
        if(!visited[child]){
            dfs(child);
            dp[n][0] = (dp[n][0] * dp[child][1])%MOD;
            dp[n][1] = (dp[n][1] * ((dp[child][0] + dp[child][1])%MOD))%MOD;
        }
    }
}

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

    for (int i = 0; i < n-1; ++i)
    {
        int x,y;cin>>x>>y;
        adj[x-1].push_back(y-1);
        adj[y-1].push_back(x-1);
    }

    for (int i = 0; i < n; ++i)
    {
        visited[i] = false;
    }


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

    dfs(0);

    cout<<(dp[0][0] + dp[0][1])%MOD;
    return 0;
} 



Measured memory_bytes: 11520
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stdio.h>
#include <math.h>

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<ll> vll;

typedef pair<int, int> pii;

typedef queue<int> qi;
typedef queue<string> qs;


#define rep(i, n) for(int i=0; i<(n); ++i)
#define repp(i, a, b) for(int i = (a); i <= (b); i++)
#define repm(i, a, b) for(int i = (a); i >= (b); i--)

#define all(v) v.begin(), v.end()
//sort( all(v) )　などと使える




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

    ll ans = 0;
    rep(i, n){
        if((i+1)%3 != 0 && (i+1)%5 != 0) ans += (i+1);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3676
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define dump(x)  cout << #x << " = " << (x) << endl;

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

ll d[102][102];
ll p[102][102];
bool visited[102][102];
set<pl> usedEdges;
void col(ll a, ll b){
    if(a == b) return;
    if(p[a][b] == -1){
        if(a < b) swap(a,b);
        usedEdges.insert({a,b});
    }
    else {
        if(!visited[a][p[a][b]])
            col(a,p[a][b]);
        if(!visited[p[a][b]][b])
            col(p[a][b],b);
    }
    visited[a][b] = true;
    visited[b][a] = true;
}

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

    ll n,m;
    cin >> n >> m;
    ll a,b,w;
    rp(i,m){
        cin >> a >> b >> w;
        d[a-1][b-1] = w;
        d[b-1][a-1] = w;
    }
    rp(i,n) rp(j,n) if(i != j && d[i][j] == 0) d[i][j] = INF;
    rp(i,n) rp(j,n) p[i][j] = -1;

    rp(i,n) rp(x,n) rp(y,n){
        if(d[x][i] + d[i][y] < d[x][y])
        {
            d[x][y] = d[x][i] + d[i][y];
            p[x][y] = i;
        }
    }
    rp(i,n) rp(j,n) col(i,j);

    cout <<m -usedEdges.size()<<"\n";
   return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 384
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

S = str(input())
S = S.replace('BC', 'D')

ans = 0
a = 0
d = 0
flag = False
for s in S[::-1]:
    if s=='D':
        if a>=1:
            ans += a*d
            a = 0
        d += 1
        flag = True
    elif s=='A':
        if flag:
            a += 1
    else:
        ans += a*d
        a,d = 0,0
        flag = False
ans += a*d

print(ans)

Measured memory_bytes: 43376
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define REP(i,n) FOR(i,0,n)
#define pb push_back
#define en "\n"
#define ITER(i,a) for( typeof(a.begin()) i=a.begin();i!=a.end();i++)
#define mod 1000000007
#define mpp make_pair
#define mes(a,b) memset((a),(b),sizeof((a))
typedef map<int,int> MI;
typedef pair<int,int>   PI;
typedef vector<int> VI;
typedef long long int LL;

int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    int a[n];
    int p=0,q=0;
    int sum=0;
    for(int i=0;i<n;i++)
    cin>>a[i],sum=sum+a[i];
    int avg=sum/n;
    for(int i=0;i<n;i++)
    {
        p=p+((a[i]-avg)*(a[i]-avg));
        q=q+((a[i]-(avg+1))*(a[i]-(avg+1)));
    }
    cout<<min(p,q)<<en;
	return 0;
}


Measured memory_bytes: 3668
#ITP1_11-B Dice 2
rep=[
    [1,2,4,3,1],
    [2,0,3,5,2],
    [0,1,5,4,0],
    [0,4,5,1,0],
    [0,2,5,3,0],
    [1,3,4,2,1]
]
d = input().split(" ")
q = int(input())
dic={}
for i in range(6):
    dic.update({d[i]:i})
for i in range(q):
    a,b = input().split(" ")
    for j in range(4):
        top=dic[a]
        front = dic[b]
        if(d[rep[top][j]]==d[front]):
            print(d[rep[top][j+1]])

Measured memory_bytes: 7668
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

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

signed main() {
  ll N, K;
  cin >> N >> K;
  vll H(N);
  rep(i, N) {
    cin >> H[i];
  }

  SORT(H);
  ll ans = lower_bound(ALL(H), K) - H.begin();
  COUT(N - ans);
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define sz 100005
int ar[2],br[2];
pair<int , int > m1[sz];
pair<int , int > m2[sz];
int main() {
	int n;
	cin >> n;
	for(int i = 1 ; i <= n ; i++)
	{  int x;
		cin >> x;
		if(i%2 == 1)
		{
			m1[x].first++;
			m1[x].second = x;
		}
		else{
			m2[x].first++;
			m2[x].second = x;
		}
	}
	sort(m1,m1+sz);
	sort(m2,m2+sz);
	if(m2[sz-1].second == m1[sz-1].second){
		cout << min(n - m1[sz-1].first - m2[sz-2].first ,n - m2[sz-1].first - m1[sz-2].first);
	}
	else
		cout << n - m1[sz-1].first - m2[sz - 1].first << endl;
	return 0;
}

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

int p[110];

inline int read(){
    int X=0,w=0; char ch=0;
    while(!isdigit(ch)) {w|=ch=='-';ch=getchar();}
    while(isdigit(ch)) X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
    return w?-X:X;
}

inline void write(int x){
     if(x<0) putchar('-'),x=-x;
     if(x>9) write(x/10);
     putchar(x%10+'0');
}

inline void writeln(int x){
     if(x<0) putchar('-'),x=-x;
     if(x>9) write(x/10);
     putchar(x%10+'0');
     puts("");
}

signed main(){
    int x=read(),n=read(),a;
    
    for(int i=1;i<=n;i++){
        a=read();
        p[a]=1;
    }
    
    for(int i=0;i<=110;i++){
        if(p[x-i]==0){
            cout<<x-i<<endl;
            return 0;
        }
        else if(p[x+i]==0){
            cout<<x+i<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3628
import java.util.*;
import java.util.stream.*;

class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int N = input.nextInt();
        Card[] cards1 = new Card[N];
        Card[] cards2 = new Card[N];
        for (int i = 0; i < N; i++){
            String tmp = input.next();
            Card tmpcard = new Card((int)tmp.charAt(1),i,tmp);
            cards1[i] = tmpcard;
            cards2[i] = tmpcard;
        }
        BubbleSort(cards1,N);
        SelectionSort(cards2,N);
        String ans = "Stable";
        for (int i = 0; i < N; i++){
            if (i == N-1){
                System.out.println(cards1[i].presentation);
            } else {
                if (cards1[i].value == cards1[i+1].value && cards1[i].index > cards1[i+1].index){
                    ans = "Not stable";
                }
                System.out.printf("%s ",cards1[i].presentation);
            }
        }
        System.out.println(ans);
        ans = "Stable";
        for (int i = 0; i < N; i++){
            if (i == N-1){
                System.out.println(cards2[i].presentation);
            } else {
                if (cards2[i].value == cards2[i+1].value && cards2[i].index > cards2[i+1].index){
                    ans = "Not stable";
                }
                System.out.printf("%s ",cards2[i].presentation);
            }
        }
        System.out.println(ans);
    }
    public static void BubbleSort(Card[] C, int N){
        Card tmp;
        for (int i = 0; i < N; i++){
            for (int j = N - 1; j > i; j--){
                if (C[j].value < C[j-1].value){
                    tmp = C[j];
                    C[j] = C[j-1];
                    C[j-1] = tmp;
                }
            }
        }
    }
    public static void SelectionSort(Card[] C, int N){
        int minj;
        Card tmp;
        for (int i = 0; i < N; i++){
            minj = i;
            for (int j = i; j < N; j++){
                if (C[j].value < C[minj].value){
                    minj = j;
                }
            }
            tmp = C[i];
            C[i] = C[minj];
            C[minj] = tmp;
        }
    }
}

class Card {
    public int value,index;
    public String presentation;

    Card(int a, int b, String c){
        value = a;
        index = b;
        presentation = c;
    }
}


Measured memory_bytes: 26444
#include <iostream>
#include <vector>

using namespace std;

vector<int> a;

bool solve(int i, int m)
{
	bool res;
	if (m == 0)
		return true;
	if (i >= a.size())
		return false;
	res = solve(i + 1, m) || solve(i + 1, m - a[i]);
	return res;
}

int main() {
	int n;
	cin >> n;
	a.resize(n);
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	int q;
	cin >> q;
	vector<int> m(q);
	for (int i = 0; i < q; i++)
	{
		cin >> m[i];
	}
	for (int i = 0; i < q; i++)
	{
		if (solve(0, m[i]))
		{
			cout << "yes" << endl;
		}
		else
		{
			cout << "no" << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> X(M);
    for (int i = 0; i < M; i++) cin >> X.at(i);

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

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

    vector<int> diff(M - 1);
    vector<P> diff_sort(M - 1);
    for (int i = 0; i < M - 1; i++) {
        diff.at(i) = abs(X.at(i + 1) - X.at(i));
        diff_sort.at(i) = make_pair(diff.at(i), i);
    }
    sort(diff_sort.begin(), diff_sort.end());//, greater<ll>());

    for (int i = 0; i < N - 1; i++) {
        ll tmp = diff_sort.at(M - 2 - i).second;
        diff.at(tmp) = 0;
    }

    ll ans = accumulate(diff.begin(), diff.end(), 0LL);
    cout << ans << endl;

    return 0;
}


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

def main():
    n = int(input())
    li = dp(n)
    print(li[n])

def dp(n):
    inf=float('inf')
    dp = [inf for i in range(n+1)]
    dp[0] = 0
    money_list = get_money_list()
    for i in range(1, n + 1):
        for pay in money_list:
            if pay > i:
                continue
            else:
                dp[i] = min(dp[i - pay] + 1, dp[i])
    return dp

def create_list(n):
    i = 1
    money_list = []
    while i < 100000:
        money_list.append(i)
        i = i * n
    return money_list

def get_money_list():
    li = create_list(9)
    li.extend(create_list(6))
    li = list(set(li))
    li.sort(key=int, reverse=True)
    return li

if __name__ == '__main__':
    main()

Measured memory_bytes: 3992
n = int(input())
count = 0
pattern = ['S', 'H', 'C', 'D']
cards = [[ False for i in range(13)] for j in range(4)]#初期値
while count < n:
    ch, rank = input().split(' ')
    rank = int(rank)
    cards[pattern.index(ch)][rank - 1] = True
    count += 1


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



Measured memory_bytes: 5604
import java.io.IOException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            solve(sc);
        }
    }

    public static void solve(Scanner sc) {
        int a = sc.nextInt();
        System.out.println(a * (a + 1) / 2);
    }
}

Measured memory_bytes: 22100
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def main():
	n = int(input())
	al = [int(input()) for _ in range(n)]
	point_set = set()
	point_set.add(0)
	
	max_point=0
	for point in al:
		for v in list(point_set):
			point_set.add(v+point)
			if (v+point)%10!=0 and v+point > max_point:
				max_point=v+point
				
		#pa(list(point_set))
		
	return max_point
	
	
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 39536
#include<iostream>
#include<vector>
#include<algorithm>


using namespace std;

int main(){

	long long n,m,sum=0;
	cin>>n;
	vector<long long> vec;
	for(int i=0;i<n;++i){
		cin>>m;
		vec.push_back(m);
		sum+=m;
	}

	sort(vec.begin(),vec.end());
	long long max,min;
	max=vec[n-1];
	min=vec[0];

	cout<<min<<" "<<max<<" "<<sum<<endl;
	
	return 0;
}

Measured memory_bytes: 1344
# coding: utf-8
import numpy as np

n = int(input())
dp = np.zeros((n+10, 3))

def cmax(a,b):
    if a>b:
        return a
    else: 
        return b
        
for i in range(1, n+1):
    a, b, c = map(int, input().split())
    # a
    dp[i][0] = cmax(dp[i-1][1]+a, dp[i-1][2]+a)
    # b
    dp[i][1] = cmax(dp[i-1][0]+b, dp[i-1][2]+b)
    # c
    dp[i][2] = cmax(dp[i-1][0]+c, dp[i-1][1]+c)

print(int(max(dp[i,:])))

Measured memory_bytes: 21664
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;
typedef uint64_t u64;

void set_at (u64 *b, i32 k) {
  b[k >> 6] |= (u64) 1 << (k & 63);
}

i32 get_at (u64 *b, i32 k) {
  return (b[k >> 6] >> (k & 63)) & 1;
}

u64 func (u64 * restrict a, u64 * restrict b, u64 * restrict c, i32 l, i32 r) {
  const u64 t = ~(u64)0;
  if (l / 64 == r / 64) {
    return ((a[l / 64] & b[l / 64] & c[l / 64]) >> (l & 63)) & (t >> (64 - (r - l + 1)));
  }
  i32 k = l / 64;
  u64 f = 0;
  f |= (a[k] & b[k] & c[k]) >> (l & 63);
  k = r / 64;
  f |= (a[k] & b[k] & c[k]) & (t >> (63 - r));
  for (i32 i = (l + 64) / 64 * 64; i + 63 <= r; i += 64) {
    f |= a[i/ 64] & b[i / 64] & c[i / 64];
  }
  return f;
}

void run (void) {
  i32 n;
  scanf ("%" SCNi32, &n);
  i32 len = (n + 63) / 64;
  u64 *array = (u64 *) calloc (3 * n * len, sizeof (u64));
  u64 **win = (u64 **) calloc (n, sizeof (u64 *));
  for (i32 i = 0; i < n; ++i) {
    win[i] = array;
    array += len;
  }
  char *s = (char *) calloc (n + 1, sizeof (char));
  for (i32 i = 1; i < n; ++i) {
    scanf ("%s", s);
    for (i32 j = 0; j < i; ++j) {
      if (s[j] == '0') {
        set_at (win[j], i);
      } else {
        set_at (win[i], j);
      }
    }
  }
  u64 **dpL = (u64 **) calloc (n, sizeof (u64 *));
  u64 **dpR = (u64 **) calloc (n, sizeof (u64 *));
  for (i32 i = 0; i < n; ++i) {
    dpL[i] = array;
    array += len;
    set_at (dpL[i], i);
    dpR[i] = array;
    array += len;
    set_at (dpR[i], i);
  }
  for (i32 len = 2; len <= n; ++len) {
    for (i32 l = 0; l + len - 1 < n; ++l) {
      i32 r = l + len - 1;
      if (func (win[l], dpR[l + 1], dpL[r], l + 1, r)) {
	set_at (dpL[r], l);
      }
      if (func (win[r], dpR[l], dpL[r - 1], l, r - 1)) {
	set_at (dpR[l], r);
      }
    }
  }
  i32 ans = 0;
  for (i32 i = 0; i < n; ++i) {
    ans += get_at (dpR[0], i) & get_at (dpL[n - 1], i);
  }
  printf ("%" PRIi32 "\n", ans);
}

int main (void) {
  run();
  return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
#define TRACE
#define M 1000000007
#define oo 1000000000000000007
#define F first
#define S second
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pll;
#define pb push_back
#define M6 5000009
#define M5 100009
#define pi 3.14159265
#define epsilon 1e-6

#ifdef TRACE
    #define trace1(x)                cerr << #x << ": " << x << endl;
    #define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
    #define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
    #define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
    #define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
    #define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
 
#else
 
    #define trace1(x)
    #define trace2(x, y)
    #define trace3(x, y, z)
    #define trace4(a, b, c, d)
    #define trace5(a, b, c, d, e)
    #define trace6(a, b, c, d, e, f)
 
#endif

ll n,m,A[M6],F[M6];
int  main()
{   //ios_base::sync_with_stdio (0), cin.tie (0);
    //sieve();
    //init();
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll tc=1,t=0,i,j,k,a,b,c,d,l,r;
    //cin>>tc;
    while(t++<tc){
//        cout<<"Case #"<<t<<": ";
        string S,T;
        cin>>S>>T;
        int ans=0;
        for (i=0;i<3;i++) ans+=(S[i]==T[i]);

            cout<<ans;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
typedef long long int ll;
const ll maxn=1e6+8;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    ll i,a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    } ll s=0;
    for(i=0;i<n-1;i++)
    {
        if(a[i]>a[i+1])
        {
            s=s+(a[i]-a[i+1]);
            a[i+1]=a[i];
        }
    }
    cout<<s;
    cerr<<"\nTime elapsed:"<< 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}


Measured memory_bytes: 5164
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstdio>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include <set>
#include <utility>
#include <functional>
using namespace std;
typedef pair<int, int> pii;
typedef pair<string, int> P;
typedef long long ll;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
const int MAXN = 100000;
const int MAXE = 100000;
const int MAXV = 10000;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

struct UnionFind{
    vector<int> par,rank;
    UnionFind(int n):par(n),rank(n){
        for(int i=0;i<n;++i) par[i]=i;
    }
    int root(int x){
        if(par[x]==x) return x;
        return par[x]=root(par[x]);
    }
    void unite(int x,int y){
        int rx=root(x),ry=root(y);
        if(rx==ry) return ;
        if(rank[ry]>rank[rx]) par[rx]=ry;
        else par[ry]=rx;
        if(rank[rx]==rank[ry]) rank[rx]++;
    }
    bool same(int x,int y){
        return root(x)==root(y);
    }
};

vector<ll> fac,inv,finv;

void initcom(){
    fac=inv=finv=vector<ll>(1e6);
    fac[0]=fac[1]=1;
    inv[1]=1;
    finv[0]=finv[1]=1;
    for(ll i=2;i<1e6;++i){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}

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

int main(){
    initcom();
    int n;cin>>n;
    vector<int> a(n+1);
    vector<int> cnt(n+1,0);
    for(int i=0;i<=n;++i){
        cin>>a[i];
        cnt[a[i]]++;
    }
    int tw=-1;
    for(int i=1;i<=n;++i)if(cnt[i]==2){
        tw=i;break;
    }
    int p=0;
    for(int i=0;i<=n;++i){
        if(a[i]==tw) break;
        p++;
    }
    for(int i=n;i>=0;--i){
        if(a[i]==tw) break;
        p++;
    }
    for(int k=1;k<=n+1;++k){
        ll ans=0;
        ans=(ans+com(n-1,k))%MOD;
        ans=(ans+com(n-1,k-2))%MOD;
        ans=(ans+com(n-1,k-1)*2-com(p,k-1)+MOD)%MOD;
        cout<<ans<<endl;
    }
    return 0;
}

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

#define ll long long
#define ull unsigned long long
#define ld long double
#define pll pair<long long,long long>
#define pcc pair<char,char>
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define vvvl vector<vector<vector<long long>>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vs vector<string>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vp vector<pair<long long,long long>>
#define umap unordered_map
#define uset unordered_set
#define Lqueue priority_queue<long long>
#define Squeue priority_queue<long long,vector<long long>,greater<long long>>
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define eb emplace_back

const int MOD1=1000000007;
const int MOD2=998244353;
const long double PI=3.1415926535897932;
const long long MAXLL=9223372036854775807;
const long long INF=2305843009213693951;
const int dx[]={0,1,0,-1,1,-1,1,-1};
const int dy[]={1,0,-1,0,1,1,-1,-1};

#define unless(a) if(!(a))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rbf(a,x) for(auto& a:x)
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(n);i++)
#define bitrep(i,s,n) for(int i=(s);i<(1LL<<(n));i++)
#define bitcheck(bit,i) (bit)&(1LL<<(i))
#define Maxe(x) *max_element((x).begin(),(x).end())
#define Mine(x) *min_element((x).begin(),(x).end())
#define Size(x) ((long long)(x).size())
#define Lin(s) getline(cin,(s))

void Yes(bool a){cout<<(a?"Yes":"No")<<endl;}
void YES(bool a){cout<<(a?"YES":"NO")<<endl;}
template<class T,class U> auto max(T a,U b){return a>b?a:b;}
template<class T,class U> auto min(T a,U b){return a<b?a:b;}
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a,long long b){return a/gcd(a,b)*b;}
long long cutup(long long a,long long b){return (a+b-1)/b;}
long long popcnt(long long a){return __builtin_popcountll(a);}
template<class T,class U> inline bool chmin(T& a,U b){if(a>b){a=b;return true;}return false;}
template<class T,class U> inline bool chmax(T& a,U b){if(a<b){a=b;return true;}return false;}

struct edge{long long to,cost;};
struct edge2{long long from,to,cost;};

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n,l,t;
    cin>>n>>l>>t;
    vl x(n),w(n);
    rep(i,n)cin>>x[i]>>w[i];
    int ind=0;
    rep(i,n){
        if(w[i]==1){
            x[i]+=t;
            if(x[i]>=l){
                ind-=x[i]/l;
                x[i]%=l;
                if(ind<0){
                    ind+=n;
                }
            }
        }else{
            x[i]-=t;
            if(x[i]<0){
                ind+=-(x[i]-(l-1))/l;
                x[i]=(x[i]%l+l)%l;
                if(ind>=n){
                    ind-=n;
                }
            }
        }
    }
    sort(all(x));
    vl Ans(n);
    rep(i,n){
        Ans[ind]=x[i];
        ind++;
        if(ind>=n)ind-=n;
    }
    rbf(a,Ans)cout<<a<<endl;
}

Measured memory_bytes: 5540
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        String s = sc.next();
        int ans = 0;
        for (int a = 0; a <= 9; a++) {
            for (int b = 0; b <= 9; b++) {
                for (int c = 0; c <= 9; c++) {
                    boolean fa = false;
                    boolean fb = false;
                    boolean fc = false;

                    for (int i = 0; i < n; i++) {
                        if (!fa) {
                            if (s.substring(i, i + 1).equals(String.valueOf(a))) {
                                fa = true;
                            }
                        } else if (!fb) {
                            if (s.substring(i, i + 1).equals(String.valueOf(b))) {
                                fb = true;
                            }
                        } else if (!fc) {
                            if (s.substring(i, i + 1).equals(String.valueOf(c))) {
                                fc = true;
                            }
                        }
                        if (fa && fb && fc) {
                            ans++;
                            break;
                        }

                    }

                }
            }
        }

        System.out.println(ans);
        sc.close();
    }
}

Measured memory_bytes: 346172
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
char in[100];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	scanf("%s",in);
	for(int i=0;i<a;i++){
		if(in[i]<'0'||in[i]>'9'){printf("No\n");return 0;}
	}
	for(int i=0;i<b;i++){
		if(in[a+1+i]<'0'||in[a+1+i]>'9'){printf("No\n");return 0;}
	}
	if(in[a]=='-')printf("Yes\n");
	else printf("No\n");
}

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

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

int ans;

class UnionFind
{
public:
    vector<int> p;

    UnionFind() {}
    UnionFind(int size)
    : p(vector<int>(size, -1))
    {}

    bool same(int x, int y)
    {
        return findSet(x) == findSet(y);
    }

    void unite(int x, int y)
    {
        x = findSet(x); y = findSet(y);
        if (x == y) return;
        --ans;

        if (p[x] > p[y]) swap(x, y);
        p[x] += p[y];
        p[y] = x;
    }

    int findSet(int x)
    {
        if (p[x] < 0) return x;
        else p[x] = findSet(p[x]);
        return p[x];
    }
};

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

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

    UnionFind uf(N);
    int x, y, z;
    ans = N;
    rep (i, M)
    {
        cin >> x >> y >> z;
        uf.unite(x - 1, y - 1);
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 640
#include<stdio.h>
int main(void){
  int a, b;
  scanf("%d %d", &a,&b);
  if(a > b){
    printf("a > b\n");
  }else if(a < b){
    printf("a < b\n");
  }else{
    printf("a == b\n");
  }
  return 0;
}


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

typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)

int main() {
    string s;cin>>s;
    cout<<s[0]<<s[1]<<s[2]<<endl;

	return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define dbug printf("I am here\n");
#define Fast ios_base::sync_with_stdio(false); cin.tie(0);
#define vs              v.size()
#define sot(v)        sort(v.begin(),v.end())
#define rev(v)        reverse(v.begin(),v.end())
#define ii                pair<int,int>
#define ll                long long
#define ull              unsigned long long
#define pb              push_back
#define mpp          make_pair
#define Okay         0
#define pi               3.14159

static ll int inf = 1e9;
const int cont = 10e6+7;
using namespace std;

void solve(){
    string a, b;
    cin>>a>>b;
    int ans = cont, cnt = 0;
    if(a.size() == b.size()){
        for(int i=0; i<b.size(); i++){
            if(a[i] != b[i])cnt++;
        }
        cout<<cnt<<endl;
        return;
    }

    for(int i=0; i<a.size() - b.size(); i++){
        for(int j = 0; j<b.size(); j++){
            if(a[j+i] != b[j])cnt++;
        }
        ans = min(ans, cnt);
        cnt = 0;
    }
    cout<< ans <<endl;
}
int main() {
  solve();
  return Okay;
}


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

int main()
{
  int h,w;
  cin >> h >> w;
  string a[1010];
  for(int i = 0;i < h;i++)
  {
    cin >> a[i];
  }
  int dp[1010][1010] = {};
  dp[0][0] = 1;
  for(int i = 0;i < h;i++)
  {
    for(int j = 0;j < w;j++)
    {
      if((i == 0 && j == 0) || a[i][j] == '#')continue;
      else
      {
        if(a[i][j] == '.')dp[i][j] = (dp[max(i - 1,0)][j] + dp[i][max(j - 1,0)]) % 1000000007;
        else dp[i][j] = 0;
      }
    }
  }
  cout << dp[h - 1][w - 1] << endl;
}

Measured memory_bytes: 5248
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-9
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N;
	ll a[100001];
	vpll ai;
	ll ans[100001]={};
	map<ll,int> kosu;
	scan(N);
	rep(i,N){
		scan(a[i]);
		if(kosu[a[i]]==0) ai.push_back({a[i],i});
		kosu[a[i]]++;
	}
	sort(rALL(ai));
	ai.push_back({0,-1});
	vll ruii,rui;
	ll sum=0;
	int num=0;
	int nowi=ai[0].second;
	rep(i,ai.size()-1){
		sum+=ai[i].first*kosu[ai[i].first];
		num+=kosu[ai[i].first];
		//printf("i:%d ai:(%lld %lld) sum:%lld num:%d nowi:%d\n",i,ai[i].first,ai[i].second,sum,num,nowi);

		if(nowi>ai[i+1].second){
			ruii.push_back(nowi);
			rui.push_back(sum-num*ai[i+1].first);
			sum-=sum-num*ai[i+1].first;
			nowi=ai[i+1].second;
		}
		//printf("i:%d ai:(%lld %lld) sum:%lld num:%d nowi:%d\n",i,ai[i].first,ai[i].second,sum,num,nowi);
	}
	rep(i,ruii.size()){
		ans[ruii[i]]=rui[i];
	}
	rep(i,N) prin(ans[i]);
	return 0;
}


Measured memory_bytes: 13296
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */


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

    ll n, m; cin >> n >> m;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    vector<ll> cum(n+4, 0);
    rep(i, n) cum[i+1] = cum[i] + a[i];

    ll ok = 0, ng = 1e9+3;
    auto check = [&](auto x) {
        ll cnt = 0;
        rep(i, n) cnt += a.end() - lower_bound(a.begin(), a.end(), x-a[i]);
        return cnt>=m;
    };
    while(ng - ok > 1) {
        ll mid = (ok+ng) / 2;
        (check(mid)? ok:ng) = mid;
    }

    ll ans = 0; ll cnt = 0;
    rep(i, n) {
        int pos = lower_bound(a.begin(), a.end(), ng-a[i]) - a.begin();
        ans += cum[n] - cum[pos];
        ans += a[i] * (n-pos);
        cnt += n - pos;
    }
    ans += ok * (m-cnt);
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 1792
A1=input().split()
A2=input().split()
A3=input().split()
N = int(input())
b = list(input() for i in range(N))

ListA = [A1,A2,A3]
for i in range(3):
  if set(ListA[i]).issubset(b):
      print("Yes")
      exit()

B1 = [A1[0],A2[0],A3[0]]
B2 = [A1[1],A2[1],A3[1]]
B3 = [A1[2],A2[2],A3[2]]
ListB = [B1,B2,B3]

for i in range(3):
    if set(ListB[i]).issubset(b):
      print("Yes")
      exit()
    
C1 = [A1[0],A2[1],A3[2]]
C2 = [A1[2],A2[1],A3[0]]
ListC = [C1,C2]

for i in range(2):
    if set(ListC[i]).issubset(b):
      print("Yes")
      exit()

print("No")

Measured memory_bytes: 3064
from collections import deque
n, m = map(int, input().split())
ab = [[] for i in range(n+1)]

for i in range(m):
    a, b = map(int, input().split())
    ab[a].append(b)
    ab[b].append(a)

ans = [-1]*(n+1)
que = deque([1])
while que:
    q = que.popleft()
    for i in ab[q]:
        if ans[i] == -1:
            que.append(i)
            ans[i] = q
print('Yes')
for i in range(2, n+1):
    print(ans[i])


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


int main(void){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, c;
  cin >> a >> b >> c;

  int cnt = 0;

  if(a != b && a != c && b != c){
    cout << "No" << '\n';
    return 0;
  }

  else if(a == b && a == c){
    cout << "No" << '\n';
    return 0;
  }

  else cout << "Yes" << '\n';
  
  return 0;
  
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, K, H, ans;

int main(){
  scanf("%d%d", &N, &K);
  for (int i = 0; i < N; i++){
    scanf("%d", &H);
    if (K <= H) ans++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
const ll INF = 1e18L + 1;


int dp[100005][2];
int main() {
  int K; cin>>K;
  vector<ll> ans;
  queue<ll> q; 
  for(int i=1; i<10; i++) q.push(i);
  while (ans.size() <= K) {
    ll a = q.front(); q.pop();
    ans.push_back(a);
    int first = a%10;
    if (first-1>=0) {
      ll target=a*10+first-1;
      q.push(target);
    }
    q.push(a*10+first);

    if (first+1<10) {
      ll target=a*10+1+first;
      q.push(target);
    }
  }
  cout << ans[K-1] << endl;
  return 0;
}

Measured memory_bytes: 2548
import bisect

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
ans = 0
for i in b:
  p = bisect.bisect_left(a, i)
  q = bisect.bisect_right(c, i)
  ans += (p*(n-q))
  
print(ans)

Measured memory_bytes: 29384
k, s = map(int, input().split())
ans = 0

s3 = s // 3
m = max(k, s3)
for x in range(0, m + 1):
    # print(x)
    for y in range(0, m + 1):
        ad = s - x - y
        if ad <= k and ad >= 0:
            ans += 1

print(ans)

Measured memory_bytes: 3060
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {
		ArrayList<Point> list = new ArrayList<Point>();
		int n = 0;
		while (in.hasNext()) {
			n++;
			String[] s = in.next().split(",");
			list.add(new Point(Double.parseDouble(s[0]), Double.parseDouble(s[1])));
		}

		Point[] poly = list.toArray(new Point[n]);
		out.println(requireAreaOfPolygon(poly));
	}

	static double requireAreaOfPolygon(Point[] poly) {
    	int n = poly.length;
    	double res = 0;
    	for (int i=0; i<n; i++) {
    		res += (poly[i].getX() - poly[(i+1)%n].getX())*(poly[(i+1)%n].getY() + poly[i].getY());
    	}
    	return Math.abs(res/2);
    }

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}

class EuclideanSpace{
	public static final double EPS = 1E-10;
	public static boolean epsEquals(double a, double b) { return Math.abs(a-b) < EPS; };
}

class Point extends EuclideanSpace implements Comparable, Cloneable {

	private double x, y;
	public Point(double x, double y) {
		this.x = x; this.y = y;
	}

	public double getX() {
		return this.x;
	}
	public double getY() {
		return this.y;
	}

	public void set(double x, double y) {
		this.x = x; this.y = y;
	}

	public int compareTo(Object another) {
		Point p = (Point)another;
		if (!epsEquals(this.x,p.x)) return this.x < p.x ? -1 : 1;
		if (!epsEquals(this.y,p.y)) return this.y < p.y ? -1 : 1;
		return 0;
	}

	public boolean equals(Point p) {
		return epsEquals(this.x,p.x) && epsEquals(this.y,p.y);
	}

	public Point clone() {
		return new Point(this.x, this.y);
	}

	public String toString() {
		return "("+x+","+y+")";
	}
}

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

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

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

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

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

int N;
int t[111111];
int x[111111];
int y[111111];

int main() {
   cin >> N;
   repp (i, 1, N+1) {
      cin >> t[i] >> x[i] >> y[i];
   }

   repp (i, 1, N+1) {
      int aa = abs(x[i]-x[i-1]);
      int bb = abs(y[i]-y[i-1]);
      int cc = abs(t[i]-t[i-1]);
      if (((aa+bb)%2 == cc%2) && cc >= (aa+bb)) {

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

   puts("Yes");

   return 0;
}

Measured memory_bytes: 1408
#include<stdio.h>


#include<string.h>
int main()
{
    char ch[1000];
    char arr[1000];
    long long int a,b,c,d,i=0,j=0,k=0,l=0,m=0,n=0;
    scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
    j=d-a;
    if(j>0)
    {
      if(b>0)
       {
        i=1;
        while(i<b)
         {
          if((i+a)==d)
           break;
          i++;
         }
    
        }
      if((i+a)!=d)
        {
         k=1;
          while(k<c)
           {
            if((a+i+k)==d)
             break;
            k++;
           }
               
        }  
    printf("%lld\n",a-k);
    } 
    else
    printf("%lld\n",d);
    
   
}

Measured memory_bytes: 1732
n, t, e = map(int, raw_input().split())
x = map(int, raw_input().split())
ans = -1
for i in xrange(n):
    l = (t - e - 1)/x[i] + 1
    u = (t + e)/x[i]
    if l<=u:
        ans = i+1
        break
print ans

Measured memory_bytes: 4204
import itertools
import math
N = int(input())
seq = list(range(N))
dic = {}
for i in range(N):
  x, y = map(int, input().split())
  dic[i] = (x,y)
ans = 0
for c in list(itertools.permutations(seq)):
  for j in range(N-1):
    nx, ny = dic[c[j+1]]
    x, y = dic[c[j]]
    ans += ((nx-x)**2 + (ny-y)**2)**0.5
print(ans/(math.factorial(N)))

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

using namespace std;

int main(int argc, char *argv[])
{
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);

    int N;
    cin >> N;

    int a, b, c, x = 0, y = 0, z = 0;
    for (int i = 0, u, v, w; i < N; i++)
    {
        cin >> a >> b >> c;
        u = max(y + a, z + a);
        v = max(x + b, z + b);
        w = max(x + c, y + c);
        x = u, y = v, z = w;
    }

    cout << max(max(x, y), z) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;
const int mod = 1e9+7;
// int sum = accumulate(a, a+n, 0LL);
// int mx = max_element(a, a+n);
// int mn = min_element(a, a+n);
// int cnt = count(a, a+n, k);

int M,D;

signed main()
{
    cin >> M >> D;

    int cnt=0;

    for(int i=1;i<=M;i++)
    {
        for(int j=1;j<=D;j++)
        {
            if(j/10>=2&&j%10>=2&&(j/10)*(j%10)==i)
            {
                cnt++;
            }
        }
    }

    cout << cnt << endl;

    return 0;
}

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

int main() {
    int a, b, k;
    cin >> a >> b >> k;
    int count = 0;

    for (int i = 100; i > 0; i--) {
        if (a % i == 0 && b % i == 0) {
            count++;
        }
        if (count == k) {
            cout << i << endl;
            break;
        }
    }
}


Measured memory_bytes: 256