akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll n, t[50] = {}, sum[50] = {};
string s[50] = {}, x;

int main() {
	cin >> n;
	rep(i, n) {
		cin >> s[i] >> t[i];
		if (i > 0)sum[i] = sum[i - 1] + t[i];
	}
	cin >> x;
	rep(i, n) {
		if (s[i] == x) {
			cout << sum[n - 1] - sum[i] << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 764
// Last Change: 08/18/2019 21:28:44.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

int main() {
  int a;
  string s;
  cin >> a;
  cin >> s;
  if (a < 3200) {
    cout << "red" << endl;
  } else {
    cout << s << endl;
  }
}



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

fn main() {
    input! {
        x: u64
    }

    println!("{}", if x < 1200 {"ABC"} else {"ARC"});
}

Measured memory_bytes: 4352
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int x[4]={1,100,10000,1000000};
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int main()
{
	int d,n;
	cin>>d>>n;if(n>99) n++;
	cout<<x[d]*n<<endl;
}


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

typedef long long ll;
typedef vector<int> Vi;
typedef vector<ll> Vl;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

//===

const int INF = int(1e9 + 7);
int dist[100005][3];

int main() {

	int N, M;
	cin >> N >> M;
	vector<Vi> to(N);
	for (int i = 0; i < M; ++i) {
		int u, v;
		cin >> u >> v;
		--u, --v;
		to[u].push_back(v);
	}
	int S, T;
	cin >> S >> T;
	--S; --T;

	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < 3; ++j) {
			dist[i][j] = INF;
		}
	}

	queue<Pii> q;
	q.emplace(S,0);
	dist[S][0] = 0;
	while (!q.empty()) {
		int v = q.front().first;
		int l = q.front().second;
		q.pop();
		for (const auto& u : to[v]) {
			int nl = (l + 1) % 3;
			if (dist[u][nl] != INF) continue;
			dist[u][nl] = dist[v][l] + 1;
			q.emplace(u, nl);
		}
	}

	int ans = dist[T][0];
	if (ans == INF) ans = -1;
	else ans /= 3;
	cout << ans << endl;
}


Measured memory_bytes: 6912
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>
#include<complex>
using namespace std;

typedef complex<double> P;

struct L : public vector<P>{
    L(const P &a, const P &b){
        push_back(a), push_back(b);
    }
};

struct C {
    P p; double r;
    C(const P &p, double r) : p(p), r(r) { }
};

const double EPS = 1e-8;

namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}

void crossPointsOfCircleAndLine(C &circle, L &l){
    P p0 = circle.p;
    double r = circle.r;
    P p1 = l[0];
    P p2 = l[1];
    double x = real(p1-p0);
    double y = imag(p1-p0);
    double z = real(p2-p0);
    double w = imag(p2-p0);
    double a = y-w;
    double b = -(x-z);
    double c = y*z - x*w;

    P cross1((a*c - b*sqrt((a*a+b*b)*r*r - c*c))/(a*a + b*b), (b*c + a*sqrt((a*a+b*b)*r*r - c*c))/(a*a + b*b));
    P cross2((a*c + b*sqrt((a*a+b*b)*r*r - c*c))/(a*a + b*b), (b*c - a*sqrt((a*a+b*b)*r*r - c*c))/(a*a + b*b));

    if(cross2 < cross1){
        swap(cross1, cross2);
    }
    printf("%.10f %.10f ", cross1.real() + p0.real(), cross1.imag() + p0.imag());
    printf("%.10f %.10f\n", cross2.real() + p0.real(), cross2.imag() + p0.imag());
}

int main(){
    double cx, cy, r, x1, y1, x2, y2;
    int q;
    cin >> cx >> cy >> r >> q;
    P p0(cx, cy);
    C circle(p0, r);

    for (int i=0;i<q;i++){
        cin >> x1 >> y1 >> x2 >> y2 ;
        P p1(x1, y1);
        P p2(x2, y2);
        L l(p1, p2);
        crossPointsOfCircleAndLine(circle, l);
    }
    return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a,a+n);
    long long ans=a[n-1];
    int cur=n-2;
    for(int i=n-3;i>=0;)
    {
        if(i>=0)
        {
            ans+=a[cur];
            i--;
        }
        if(i>=0)
        {
            ans+=a[cur];
            i--;
        }
        else
            break;
        cur--;
    }
    cout<<ans;
}

Measured memory_bytes: 4324
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n = readline() |> parseInt
	a,b = readline() |> split |> parseMap
	p = readline() |> split |> parseMap
	x = 0
	y = 0
	z = 0
	for i in 1:n
		if p[i]<=a
			x+=1
		elseif p[i]<=b
			y+=1
		else
			z+=1
		end
	end
	println(min(x,y,z))
end

main()

Measured memory_bytes: 111708
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A - Dodecagon
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int r;
  scanf("%d", &r);
  printf("%d\n", r * r * 3);
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main (void) {
	int a,b,sum,keta = 0;
	
	while (scanf("%d %d",&a,&b) == 2) {
		sum = a + b;
		while(sum>0){
			keta++;
			sum/=10;
		}
		printf("%d\n",keta);
		sum = 0;
		keta = 0;
	}
    return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
using namespace std;
#define INF (1<<26)
#define MAX_N 105
#define MAX_H 30
struct edge{int to,cost,h,r;};
struct state{
  int pos,cost,h;
  bool operator < (const state& p)const{return cost>p.cost;}
};

int N,M,H,K,si,ti,P;
vector<edge> G[MAX_N];
int l[1000],d[1000],k[1000];

int dp[(1<<10)];
int rec(int S){
  if(dp[S]!=-1)return dp[S];
  if(S==0)return 0;
  int res=INF;
  for(int i=0;i<P;i++){
    int nS=S&~k[i];
    if(S==nS)continue;
    res=min(res,d[i]+rec(nS));
  }
  return dp[S]=res;
}

int dist[MAX_N][MAX_H];
int solve(int S){
  for(int i=0;i<MAX_N;i++)
    for(int j=0;j<MAX_H;j++)
      dist[i][j]=INF;
  dist[si][0]=0;
  priority_queue<state> Q;
  Q.push((state){si,0,0});
  while(!Q.empty()){
    state s=Q.top();Q.pop();
    if(s.cost>dist[s.pos][s.h])continue;
    for(int i=0;i<(int)G[s.pos].size();i++){
      edge e=G[s.pos][i];
      int ncost=s.cost+e.cost;
      if((S>>e.r)&1)ncost-=e.cost;
      int nh=s.h+e.h;
      if(nh>H)continue;
      if(ncost>=dist[e.to][nh])continue;
      dist[e.to][nh]=ncost;
      Q.push((state){e.to,ncost,nh});
    }
  }
  int res=INF;
  for(int i=0;i<=H;i++)res=min(res,dist[ti][i]);
  return res;
}

void init(){
  for(int i=0;i<(1<<10);i++)dp[i]=-1;
  for(int i=0;i<MAX_N;i++)G[i].clear();
}

int main(){
  while(1){
    cin>>N>>M>>H>>K;
    if(N+M+H+K==0)break;
    init();
    int a,b,c,h,r;
    for(int i=0;i<M;i++){
      cin>>a>>b>>c>>h>>r;
      a--,b--,r--;
      G[a].push_back((edge){b,c,h,r});
      G[b].push_back((edge){a,c,h,r});
    }
    cin>>si>>ti>>P;
    si--,ti--;
    for(int i=0;i<P;i++){
      cin>>l[i]>>d[i];
      k[i]=0;
      for(int j=0;j<l[i];j++){
	int num;cin>>num;num--;
	k[i]+=(1<<num);
      }
    }
    int ans=INF;
    for(int i=0;i<(1<<K);i++)
      ans=min(ans,solve(i)+rec(i));
    cout<<(ans==INF?-1:ans)<<endl;
  }
  return 0;
}

Measured memory_bytes: 1376
from collections import Counter
n=int(input())
if n==1:
  print(1)
  exit()
xy=[tuple(map(int,input().split())) for _ in range(n)]
xy.sort()
l=[]
for i in range(n-1):
  for j in range(i+1,n):
    l.append((xy[j][0]-xy[i][0],xy[j][1]-xy[i][1]))
print(n-Counter(l).most_common()[0][1])

Measured memory_bytes: 3572
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);

    int n, k;
    int[] blood;
    boolean ans;

    void run(){
	while(sc.hasNext()){
	    n = sc.nextInt();
	    k = sc.nextInt();
	    if(n==0 && k==0) break;
	    blood = new int[k];
	    ans = true;

	    for(int i=0; i<k; i++)
		blood[i] = sc.nextInt();
	    
	    for(int i=0; i<n; i++)
		for(int j=0; j<k; j++){
		    blood[j] -= sc.nextInt();
		    if(blood[j]<0) ans = false;
		}

	    System.out.println(ans ? "Yes" : "No");
	}
    }
}

Measured memory_bytes: 93264
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
#include <unordered_set>
using namespace std;
constexpr int64_t MOD = 1e9 + 7;

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

  long double A,B;
  cin >> A >> B;
  //cout << A << endl;
  //cout << B << endl;
  //cout << A*B << endl;
  int64_t res = floor(A * B);

  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3752
/*Author- Soumak Poddar*/

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

#define ll long long int
#define sll signed long long int
#define ull unsigned long long int
#define um unordered_map
#define us unordered_set
#define mm multimap
#define mp make_pair
#define pb push_back
#define M 1000000007

bool comp(pair<int,int> a,pair<int,int> b)
{
   return a.second<b.second;
}

template<typename T>
T gcd(T a,T b)
{
   if(a==0)
      return b;
   return gcd(b%a,a);
}
template<typename T>
T lcm(T a,T b)
{
   ll g=gcd<T>(a,b);
   return (a*b)/g;
}
template<typename T>
bool isprime(T n)
{
   if(n<=1)
      return false;
   for (int i = 2; i < n; i++)
      if (n % i == 0)
         return false;
   return true;
}

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

   #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("error.txt", "w", stderr);
      freopen("output.txt", "w", stdout);
   #endif
   
   int t=1;
   // cin>>t;
   while(t--)
   {
      solve();
      cout<<"\n";
   }
   cerr<<"Time Taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
   return 0;
}
void solve()
{
   int x;
   cin>>x;
   if(x>=30)
      cout<<"Yes";
   else
      cout<<"No";
}

Measured memory_bytes: 3760
a, b = map(int, raw_input().strip().split(' '))

memo = [0 for _ in xrange(b + 1)]
for _ in xrange(a) :
    for x in  map(int, raw_input().strip().split(' '))[1:] :
        memo[x] += 1

print len([0 for x in xrange(len(memo)) if memo[x] == a])





Measured memory_bytes: 2568
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <limits.h>
#include <stdbool.h>

typedef double db;
typedef int in;
typedef long int li;
typedef long long int lli;
typedef long ld;
typedef long lld;

#define pi M_PI
#define in scanf
#define out printf
#define inf INT_MAX
#define rep(i,n) for(int i=0;i<n;++i)
#define debugd(d) printf("%d\n",d)
#define debugs(s) printf("%s\n",s)
#define debugc(c) printf("%c\n",c)
#define debugf(f) printf("%f\n",f)


int main (void)
{
  int x,t;
  in("%d %d \n",&x,&t);
  printf("%d\n",x>t?x-t:0);
  return 0;
}

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

int main() {
  int N;
  cin>>N;
  int t[N+1],x[N+1],y[N+1];
  t[0]=0;
  x[0]=0;
  y[0]=0;
  int i;
  for(i=1;i<=N;i++) {
    cin>>t[i]>>x[i]>>y[i];
  }
  int dis,time;
  string ans="Yes";
  for(i=0;i<N;i++) {
    time=t[i+1]-t[i];
    dis=abs(x[i+1]-x[i])+abs(y[i+1]-y[i]);
    if(time<dis||(time-dis)%2!=0) ans="No";
  }
  cout<<ans<<endl;
}    

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

vector<long long> input(long long N){
    long long i;
    vector<long long> output(N);
    for(i=0;i<N;i++)cin>>output[i];
    return output;
}

int main(){
    long long N,i,j,result;
    vector<long long> A;
    cin>>N;
    A=input(N);

    for(i=0;i<N;i++){
        j=0;
        while(A[i]%2==0){
            A[i]/=2;
            j++;
        }
        if(i==0)result=j;
        if(j<result)result=j;
    }

    cout<<result<<endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acosl(-1);

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

    int N;
    cin >> N;
    ll ans = 0;
    for (int i = 1; i <= N; ++i) {
        ans += N / i;
        if (N % i == 0)
            ans--;
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
	lint X, K, D;
	cin >> X >> K >> D;
	lint a=0, b=0, c=0, x, y, z;
	X = abs(X);
	x = X / D;
	if (x > K) {
		std::cout << X - K * D << '\n';
		return 0;
	}
	X -= x * D;
	K -= x;
	if (K%2 == 1) {
		X -= D;
		X = abs(X);
	}
	std::cout << X << '\n';
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll a;
    cin >> a;
    cout << a +  a * a + a * a * a << endl;
    return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, a; cin>>n>>a;
	vll x(n);
	ll sum=0;
	rep(i, n){
		cin>>x[i];
		sum+=x[i];
	}
	vector<vector<vll> > dp(n+1, vector<vll>(sum+51, vll(n+1, 0)));
	dp[0][0][0] = 1;
	for(int i=0; i<n; i++){
		for(int j=0; j<=sum; j++){
			for(int k=0; k<n; k++){
				dp[i+1][j][k] += dp[i][j][k];
				dp[i+1][j+x[i]][k+1] += dp[i][j][k];
				
			}
		}
	}
	ll ans=0, idx=1;
	while(idx*a<=sum && idx<=n){
		ans += dp[n][idx*a][idx];
		idx++;
	}
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 57216
while True:
    m, f, r = [int(i) for i in input().split()]
    if m == -1 and f == -1 and r == -1:
        break
    elif m == -1 or f == -1:
        print("F")
    elif m + f >= 80:
        print("A")
    elif m + f < 80 and m + f >= 65:
        print("B")
    elif m + f < 65 and m + f >= 50:
        print("C")
    elif m + f < 50 and m + f >= 30 and r >= 50:
        print("C")
    elif m + f < 50 and m + f >= 30:
        print("D")
    elif m + f < 30:
        print("F")



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

long long a, b, c, k, ans;
long long inf = (long long)1e18;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> a >> b >> c >> k;
	ans = (k % 2 == 0 ? a - b : b - a);
	if(ans > inf || -ans > inf) cout << "Unfair\n";
	else cout << ans << "\n";
}

Measured memory_bytes: 256
import math
import sys
import numpy as np
from collections import defaultdict, deque, Counter 
from itertools import accumulate, product, permutations,combinations, combinations_with_replacement
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd

max_value = 1000000000
min_value = -1000000000
sys.setrecursionlimit(max_value)

m, d = map(int,input().split())

count = 0
for i in range(1,m+1):
    for j in range(10,d+1):
        first_d = int(str(j)[1])
        second_d = int(str(j)[0])
        if i == first_d * second_d and first_d >= 2 and second_d >= 2:
            count += 1

print(count)

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

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

  string A;
  for (int i=0; i<S.size(); i++){
    if (S.at(i)=='0'){
      A += '0';
    }
    else if (S.at(i)=='1'){
      A += '1';
    }
    else {
      if (A.size()==0){
        continue;
      }
      A.pop_back();
    }
  }

  cout << A << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int n, m, q;
vector<int> a, b, c, d;
int ans;

void dfs(vector<int> graph) {
    if (graph.size() == n + 1) {
        int sum = 0;
        REP(i, q) if (graph[b[i]] - graph[a[i]] == c[i]) sum += d[i];
        ans = max(ans, sum);
        return ;
    }
    graph.push_back(graph.back());
    while (graph.back() <= m) {
        dfs(graph);
        graph.back()++;
    }
}

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

    cin >> n >> m >> q;
    a = b = c = d = vector<int>(q);
    REP(i, q) cin >> a[i] >> b[i] >> c[i] >> d[i];

    dfs(vector<int>(1, 1));

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


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 50
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S;
ll ans = 0;

int main() {
	cin >> N >> M;
	if (N == 1 && M == 1)cout << 1 << endl;
	else if (N == 1 || M == 1) cout << N * M - 2 << endl;
	else cout << N * M - 2 * N - 2 * M + 4 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>

using namespace std;



int main(){
    int n;
    cin >> n;
    long long a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }

    sort(a,a+n);

    long long max = a[n-1];
    long long near = 0;

    for(int i = 0; i < n; i++){
        if(abs((double)max/2 - near) >abs((double)max/2 - a[i])){
            near = a[i];
        }
    }

    long long con = 0;

    if (near > max/2){
        con = max-near;
    }else{
        con = near;
    }

    cout << max << " " << near << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

lli a[1000], b[1000];
lli c[1000] = {};

lli dp[1001][5000] = {};

int main(void) {

	lli N, M;
	cin >> N >> M;

	for (int i = 0; i < M; i++) {
		cin >> a[i] >> b[i];

		for (int j = 0; j < b[i]; j++) {
			lli t;
			cin >> t;
			t--;
			c[i] |= (1LL << t);
		}
	}

	for (int i = 0; i <= M; i++) {
		for (int j = 0; j < 5000; j++)
			dp[i][j] = INF;
	}

	dp[0][0] = 0;

	for (int i = 0; i < M; i++) {
		for (int j = 0; j < 5000; j++) {
			//引継ぎ
			dp[i + 1][j] = std::min(dp[i + 1][j], dp[i][j]);
			//更新
			dp[i + 1][j | c[i]] = std::min(dp[i + 1][j | c[i]],dp[i][j] + a[i]);
		}
	}

	if (dp[M][(1 << N) - 1] == INF)
		COUT(-1);
	else
		COUT(dp[M][(1 << N) - 1]);
	

	return 0;
}

Measured memory_bytes: 39424
import math

N = int(input())
X = list(map(int, input().split()))

s = sum(X) / N

p1 = math.floor(s)
p2 = math.ceil(s)

l1 = 0
l2 = 0

for x in X:
    l1 += (x - p1) ** 2
    l2 += (x - p2) ** 2

print(min(l1, l2))


Measured memory_bytes: 3060
#include <stdio.h>

int main(int argc, const char * argv[]) {
    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: 2060
import scala.io.StdIn._
object Main extends App {
  val x = readLong
  println(binSearch(500000000, 1, 1000000000))

  @scala.annotation.tailrec
  def binSearch(n: Long, l: Long, r: Long): Long = {
    val (min, max) = range(n)
    if (min < x && x <= max) n
    else if (x <= min) binSearch((l + n) / 2, l, n)
    else binSearch((r + n) / 2, n, r)
  }

  def range(n: Long): (Long, Long) = {
    val sum = n * (n + 1) / 2
    (sum - n, sum)
  }
}


Measured memory_bytes: 25408
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String S = sc.next();

		for(int i = 0;i<Math.pow(2, 3);i++) {
			StringBuilder sb = new StringBuilder(S);
			boolean plus = true;
			int judge = 0;


			for(int j = 2;j>=0;j--) {
				if((1&i>>j)==1) {
					sb.insert(j+1, "+");
				}else {
					sb.insert(j+1, "-");
				}
			}

			String str = sb.toString();

			for(int n = 0;n<7;n++) {

				char st =str.charAt(n);

				if(n==0) {
					judge+= Character.getNumericValue(st);
					continue;
				}else if(n%2==0) {
					if(plus==true) {
					judge+= Character.getNumericValue(st);
					}else {
					judge-= Character.getNumericValue(st);
					}
				}else if(n%2==1) {
					if(st=='+') {
						plus=true;
					}else {
						plus =  false;
					}
				}


			}
			if(judge==7) {
				System.out.println(str+"=7");
				break;

			}
			
		}
	}
}

Measured memory_bytes: 23764
using System;

class Program
{
  static void Main(string[] args)
  {
    var input = Console.ReadLine().Split(' ');
    var a = int.Parse(input[0]);
    var b = int.Parse(input[1]);
    var c = int.Parse(input[2]);
    var ans = string.Empty;
    if (b-a == c-b)
      ans = "YES";
    else
      ans = "NO";
    Console.WriteLine(ans);
  }
}

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


int main() {
  char a;
  cin>>a;
  if(a-'a'<0){
    cout<<'A'<<endl;
  }
  else{
    cout<<'a'<<endl;
  }
}




Measured memory_bytes: 3628
def main():
    n=int(input())
    a=list(map(int,input().split()))
    cnt=0
    for i in range(n-1):
        id=i
        mini=a[i]
        ch=False
        for j in range(i,n):
            if mini>a[j]:
                mini=a[j]
                id=j
                ch=True
        if ch:
            a[i],a[id]=a[id],a[i]
            cnt+=1
    print(*a)
    print(cnt)

main()


Measured memory_bytes: 5604
#include<bits/stdc++.h>
#define ll long long int
#define vi vector<int>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define lop(i,a,b) for(ll i=a;i<b;i++)
using namespace std;

void func(){
    int n;
    cin>>n;
    vi a(n);
    lop(i,0,n)cin>>a[i];
    int xo=a[0];
    lop(i,1,n)xo^=a[i];
    lop(i,0,n)cout<<(xo^a[i])<<" ";
    cout<<endl;
}

int main(){
    fastio;
    int t=1;
    //cin>>t;
    while(t--){
        func();
    }
}

Measured memory_bytes: 3820
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

A_cnt = Counter(A)
tmp = sum([x-1 for x in A_cnt.values()]) % 2
print(len(A_cnt) if tmp == 0 else len(A_cnt)-1)


Measured memory_bytes: 19036
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)

/*
11
1 1 1 1 0 0 0 1 1 1 0

13
1 1 1 1 1 1 0 1 1 1 1 1 1

17
1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1 1

19
1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1
*/

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

template<typename T>
vector<T> polynomial_division(vector<T> a, const vector<T> &b, T p){
	int n = a.size(), m = b.size();
	vector<T> ans(n-m+1,0);
	for(int i=0; i+m-1<n; i++){
		if(a[n-1-i]==0)continue;
		T r = (a[n-1-i]/b[m-1])%p;
		ans[n-m-i]=r;
		for(int j=0; j<m; j++){
			a[n-1-i-j]=(a[n-1-i-j]+p-(r*b[m-1-j])%p)%p;
		}
	}
	// bool ok=true;
	// for(int i=0; i<n-m+1; i++)if(a[i]!=0)ok=false;
	// if(ok)cerr<<"アウト"<<endl;
	return ans;
}

bool f(vector<ll> v,ll x,ll p){
	bool ok=true;
	rep(i,p){
		ll t=1,tmp=0;
		rep(j,p){
			tmp = (tmp+t*v[j])%p;
			t=(t*i)%p;
		}
		if(i==x && tmp==0)ok=false;
		if(i!=x && tmp!=0)ok=false;
	}
	return ok;
}

// LIBRARY END

ll p,a[3001],b[3001];
vector<ll> poly,mot,ans;

void init(){
	cin>>p;
	rep(i,p)cin>>a[i];
	rep(i,p)poly.push_back(a[i]);
	ans.assign(p,0);
	mot.assign(p+1,0);
	mot[p]=1; mot[1]=-1;
}

int main(void){
	init();
	rep(i,p){
		vector<ll> div_pol={-i,1};
		vector<ll> v = polynomial_division(mot,div_pol,p);
		rep(j,p)v[j] = ((v[j]%p)+p)%p;
		// if(f(v,i,p))cerr<<i<<"がヤバい"<<endl;
		ll div=1;
		rep(j,p){
			if(j!=i){
				div=(div*(i-j))%p;
			}
		}
		div=((div%p)+p)%p;
		// cerr<<div<<endl;
		div = modinv(div,p);
		rep(j,p)ans[j]=(ans[j]+a[i]*v[j]*div)%p;
		// rep(i,v.size())cerr<<v[i]<<" ";
		// cerr<<endl;
	}
	// Verification
	bool ok=true;
	rep(i,p){
		ll x=1,tmp=0;
		rep(j,p){
			tmp = (tmp+x*ans[j])%p;
			x=(x*i)%p;
		}
		// cerr<<tmp<<endl;
		if(tmp!=a[i])ok=false;
	}
	cerr<<(ok?"大丈夫":"ダメ")<<endl;
	// print the answer
	rep(i,ans.size())cout<<ans[i]<<" ";
	cout<<endl;
	return 0;
}

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

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

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

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

template <class T>
class SegmentTree {
    public:
        unsigned int N;
        vector<T> dat;
        T def;
        std::function<T(T, T)> operation;

        SegmentTree(int _n, T _def=1001001001, function<T(T, T)> _operation=[](T a, T b){return min(a, b);});
        T query(int a, int b, int k=0, int l=0, int r=-1);
        void update(int k, T a);
};

template <class T>
SegmentTree<T>::SegmentTree(int _n, T _def, function<T(T, T)> _operation):
    def(_def), operation(_operation) {
    N = 1;
    while (N < _n) N *= 2;
    dat = vector<T>(2*N-1, def);
}

template <class T>
T SegmentTree<T>::query(int a, int b, int k, int l, int r) {
    if (r < 0) r = N;

    if (r <= a || b <= l) return def;
    if (a <= l && r <= b) return dat[k];
    T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
    T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
    return operation(vl, vr);
}

template <class T>
void SegmentTree<T>::update(int k, T a) {
    k += N - 1;
    dat[k] = a;

    while (0 < k) {
        k = (k - 1) / 2;
        dat[k] = operation(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
}

int main(){
    int N, Q;
    string S;
    cin >> N >> S >> Q;

    SegmentTree<int> st(N, 0, [](int a, int b){return a | b;});

    rep(i, N) st.update(i, 1 << (S[i] - 'a'));

    rep(_, Q) {
        int t;
        cin >> t;
        if (t == 1) {
            int a;
            char c;
            cin >> a >> c;
            st.update(--a, 1 << (c - 'a'));
        } else {
            int l, r;
            cin >> l >> r;
            int s = st.query(--l, r);
            int ans = __builtin_popcount(s);
            cout << ans << endl;
        }
    }
}

Measured memory_bytes: 4996
import sys
input = sys.stdin.readline
N = int(input())
P = tuple([int(i) for i in input().split()])
Q = tuple([int(i) for i in input().split()])
li = [0] * N
for i in range(N) :
    li[i] = i+1
import itertools
from itertools import permutations
c = list(itertools.permutations(li))
a = 0
b = 0
for i in range(len(c)) :
    if c[i] == P :
        a = i
    if c[i] == Q :
        b = i
print(abs(b-a))

Measured memory_bytes: 8052
package main

import (
	"fmt"
)

func main() {
	var n int
	sum := 0
	max := -1000000
	min := 1000000

	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)

		if max < a {
			max = a
		}

		if min > a {
			min = a
		}

		sum += a
	}

	fmt.Println(min, max, sum)
}



Measured memory_bytes: 1804
#include<iostream>
using namespace std;
main()
{
    int i,a,b;
    cin>>a>>b;
    if(a>b)
    {
        for(i=0; i<a; i++)
            cout<<b;
    }
    else if (b>=a)
    {
        for(i=0; i<b; i++)
            cout<<a;
    }
    cout<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(cont) cont.begin(), cont.end()
#define pb push_back
#define fi first
#define se second
#define DEBUG(x) cerr << (#x) << ": " << (x) << '\n'
 
using namespace std;
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef long long ll;
typedef unsigned long long ull;
 
template<class T> bool uin(T &a, T b) {return (a < b ? false : (a = b, true));}
template<class T> bool uax(T &a, T b) {return (a > b ? false : (a = b, true));}
 
//~ ifstream f(".in");
//~ ofstream g(".out");
 
const int NMAX = 3e3 + 5;
const int MOD = 1e9 + 7;

char s[NMAX];
 
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
#ifdef LOCAL_DEFINE
  freopen(".in", "r", stdin);
#endif
 
  int n;
  cin >> n;
  cin.get();
  cin.getline(s + 1, NMAX);
 
  vector<int> dp(n + 2);
  dp[1] = 1;
  for (int i = 1; i <= n - 1; ++i) {
    vector<int> new_dp(n + 2);
    for (int last = 1; last <= i; ++last) {
      if (s[i] == '<') {
        (new_dp[last + 1] += dp[last]) %= MOD;
        (new_dp[i + 2] += MOD - dp[last]) %= MOD;
      } else {
        (new_dp[1] += dp[last]) %= MOD;
        (new_dp[last + 1] += MOD - dp[last]) %= MOD;
      }
    }
    for (int last = 1; last <= i + 1; ++last) {
      (new_dp[last] += new_dp[last - 1]) %= MOD;
    }
    dp = new_dp;
  }
  
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    (ans += dp[i]) %= MOD;
  }
  
  cout << ans << '\n';
 
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}


Measured memory_bytes: 384
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
ll rdn()
{
  ll ret=0;bool fx=1;char ch=getchar();
  while(ch>'9'||ch<'0'){if(ch=='-')fx=0;ch=getchar();}
  while(ch>='0'&&ch<='9')ret=ret*10+ch-'0',ch=getchar();
  return fx?ret:-ret;
}
ll Mx(ll a,ll b){return a>b?a:b;}
ll Mn(ll a,ll b){return a<b?a:b;}
const int N=1e5+5; const ll INF=3e10+5;
int n,m,Q;ll s[N],t[N];
int getl(ll x,bool fx)
{
  int l=1,r=(fx?m:n),ret=0;
  while(l<=r)
    {
      int mid=l+r>>1;
      if((fx?t[mid]:s[mid])<=x)
	ret=mid,l=mid+1;
      else r=mid-1;
    }
  return ret;
}
int getr(ll x,bool fx)
{
  int l=1,r=(fx?m:n),ret=0;
  while(l<=r)
    {
      int mid=l+r>>1;
      if((fx?t[mid]:s[mid])>=x)
	ret=mid,r=mid-1;
      else l=mid+1;
    }
  return ret;
}
int main()
{
  n=rdn();m=rdn();Q=rdn();
  for(int i=1;i<=n;i++)s[i]=rdn();
  for(int i=1;i<=m;i++)t[i]=rdn();
  sort(s+1,s+n+1); sort(t+1,t+m+1);
  while(Q--)
    {
      ll x=rdn();
      int l1=getl(x,0), r1=getr(x,0);
      int l2=getl(x,1), r2=getr(x,1);
      ll ans=INF;
      if(l1&&l2)ans=Mn(ans,x-Mn(s[l1],t[l2]));
      if(r1&&r2)ans=Mn(ans,Mx(s[r1],t[r2])-x);
      if(l1&&r2)ans=Mn(ans,t[r2]-s[l1]+Mn(x-s[l1],t[r2]-x));
      if(l2&&r1)ans=Mn(ans,s[r1]-t[l2]+Mn(x-t[l2],s[r1]-x));
      printf("%lld\n",ans);
    }
  return 0;
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+100;
int h[maxn];
int dp[maxn];
int n;
int main(){
    scanf("%d",&n);
    for (int i=0;i<n;i++){
        scanf("%d",h+i);
    }
    for (int i=1;i<n;i++){
        dp[i] = dp[i-1] + abs(h[i] - h[i-1]);
        if (i != 1){
            dp[i] = min(dp[i],dp[i-2] + abs(h[i] - h[i-2]));
        }
    }
    cout<<dp[n-1]<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <vector>
#include <iostream>
using namespace std;
vector<int> MAX(vector<int> v1, vector<int> v2) {
	int s1 = 0, s2 = 0;
	for(int i = 0; i < v1.size(); i++) s1 += v1[i];
	for(int i = 0; i < v2.size(); i++) s2 += v2[i];
	if(s1 > s2) return v1;
	return v2;
}
int n, x, m, l[10], r[10], s[10]; vector<int> ret;
void rec(vector<int> v) {
	if(v.size() == n) {
		for(int i = 0; i < m; i++) {
			int sum = 0;
			for(int j = l[i] - 1; j < r[i]; j++) sum += v[j];
			if(sum != s[i]) return;
		}
		ret = MAX(ret, v); return;
	}
	v.push_back(-1);
	for(int i = 0; i <= x; i++) {
		v.back() = i; rec(v);
	}
}
int main() {
	scanf("%d%d%d", &n, &x, &m);
	for(int i = 0; i < m; i++) scanf("%d%d%d", &l[i], &r[i], &s[i]);
	rec({});
	if(ret.size() == 0) printf("-1\n");
	else {
		for(int i = 0; i < n; i++) {
			if(i) printf(" ");
			printf("%d\n", ret[i]);
		}
	}
}

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

int main(){
	
  string s;
  cin>>s;
  int ans;
  if(s == "SUN") ans = 7;
  else if(s == "SAT") ans = 1;
  else if(s == "FRI") ans = 2;
  else if(s == "THU") ans = 3;
  else if(s == "WED") ans = 4;
  else if(s == "TUE") ans = 5;
  else ans = 6;

  
  cout<<ans;
  
  return 0;
}

Measured memory_bytes: 256
package main

import (
  "fmt"
  
)

func main() {
  var bingo [3][3]int
  var a, b, c int
  for i:=0; i < 3; i++ {
      fmt.Scan(&a, &b, &c)
      bingo[i][0], bingo[i][1], bingo[i][2] = a,b,c
  }
 
  
  var n, N int
  fmt.Scan(&N)
  for i:=0; i < N; i++ {
      fmt.Scan(&n)
      search(n, &bingo)
  }
  
  if itsBingo(bingo) {
        fmt.Println("Yes")
    } else {
        fmt.Println("No")
    }
}

func search(n int, bingo *[3][3]int) {
    old := *bingo
    for i, iv := range old {
        for j, jv := range iv {
            if jv == n {
                old[i][j] = 0
            }
        } 
    }
    *bingo = old
    
}

func itsBingo(bingo [3][3]int) bool {
    
    for i:=0; i < 3; i++ {
        for j:=0; j < 3; j++ {
            if bingo[i][j] == 0 {
                if j == 1 {
                    var count int
                    for k:=0; k < 3; k++ {
                        if bingo[k][j] == 0 {
                            count++
                        }
                    }
                    if count == 3 {
                        return true
                    }
                } else if j == 0 {
                    var count int
                    for k:=0; k < 3; k++ {
                        if bingo[i][k] == 0 {
                            count++
                        }
                    }
                    
                    if count == 3 {
                        return true
                    }
                    
                    count = 0
                    for k:=0; k < 3; k++ {
                        if bingo[k][i] == 0 {
                            count++
                        }
                    }
                    
                    if count == 3 {
                        return true
                    }
                    
                    count = 0
                    if i == 0 {
                        for k:=0; k < 3; k++ {
                            if bingo[k][k] == 0 {
                                count++
                            }
                        }
                        if count == 3 {
                            return true
                        }
    
                    } else if i == 2 {
                        for k:=0; k < 3; k++ {
                            if bingo[i-k][k] == 0 {
                                count++
                            }
                        }
                        
                        if count == 3 {
                            return true
                        }
                    }
                    
                    
                } else if j == 2 {
                    var count int
                     for k:=0; k < 3; k++ {
                        if bingo[k][j] == 0 {
                            count++
                        }
                    }
                    if count == 3 {
                        return true
                    }
                    
                }
            }
        }
    }
    return false
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<algorithm>
#define REP(i,a,b) for(i=a;i<=b;i++)
#define Rep(i,a,b) for(i=a;i>=b;i--)
using namespace std;
const int maxn=400+10,maxm=100000+10;
int a[maxm], b[maxm];
bool bz[maxn][maxn], p[maxn], lzx;
int i, j, k, l, r, t, x, y, n, m, ans;
int main(){
	//qwq
    scanf("%d%d",&n,&m);
    REP(i,1,m) scanf("%d%d",&a[i],&b[i]);
    REP(i,1,n){
        p[i]=1;
        bz[i][i]=1;
        Rep(j,m,1){
            x=a[j];y=b[j];
            if (!bz[i][x]&&!bz[i][y]) continue;
            if (bz[i][x]&&bz[i][y]){
                p[i]=0;
                break;
            }
            bz[i][x]=bz[i][y]=1;
        }
    }
    REP(i,1,n-1)
        REP(j,i+1,n)
            if (p[i]&&p[j]){
                lzx=1;
                REP(k,1,n)
                    if (bz[i][k]&&bz[j][k]){
                        lzx=0;
                        break;
                    }
                if (lzx) ans++;
            }
    printf("%d",ans);
}

Measured memory_bytes: 1152
n = int(input())
num = list(map(int, input().split()))
newNum = [abs(num[i]) for i in range(n)]
total = sum(newNum)
count = 0
for i in range(n):
    if num[i] < 0:
        count += 1
if (count % 2) == 0:
    print(total)
else:
    total -= min(newNum) * 2
    print(total)

Measured memory_bytes: 14412
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

A, B, X = LI()

if A <= X <= A + B:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 10820
#include <stdio.h>

long long abs(long long A);
int main(void)
{
    long long X,K,D,q,r,ans=0;
    scanf("%lld %lld %lld",&X,&K,&D);
    X=abs(X);
    D=abs(D);
    q=X/D;
    r=X%D;

    if(K<=q){
        ans=X-K*D;
        // printf("A");
    } else {
        if((K-q)%2==0){
            ans=X%D;
            // printf("B");
        } else {
            ans=abs(D-X%D);
            // printf("C");
        }
    }
    printf("%lld",ans);
    return 0;
}

long long abs(long long A)
{
    if(A<0) A=(-1)*A;
    return A;
}


Measured memory_bytes: 1732
k = int(input())

ans = []

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

ans = [
        gcd(gcd(a, b), c) 
            for a in range(1, k+1)
            for b in range(1, k+1)
            for c in range(1, k+1)
      ]
print(sum(ans))


Measured memory_bytes: 208452
#include <iostream>

using namespace std;

int main(){
  int h,w;
  char in[50][50];
  char out[50][50];
  cin >> h >> w;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin >> in[i][j];
    }
  }

  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(in[i][j] == '#') {cout << '#'; continue;}
      int count = 0;
      for(int k=-1;k<=1;k++){
        if(i+k<0 || i+k>=h) continue;
        for(int l=-1;l<=1;l++){
          if(j+l<0 || j+l>=w) continue;
          if(in[i+k][j+l] == '#') count++;
        }
      }
      cout << count;
    }
    cout << endl;
  }


  return 0;
}


Measured memory_bytes: 256
/*************************************************************************
	> File Name: 1.cpp
	> Author: Knowledge_llz
	> Mail: 925538513@qq.com 
	> Blog: https://blog.csdn.net/Pig_cfbsl 
	> Created Time: 2020/5/2 20:44:09
 ************************************************************************/
#include<map>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#define LL long long
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
using namespace std;
int read(){
	char x=getchar(); int u=0,fg=0;
	while(!isdigit(x)){ if(x=='-') fg=1; x=getchar(); }
	while(isdigit(x)){ u=(u<<3)+(u<<1)+(x^48); x=getchar(); }
	return fg?-u:u;
}
map<LL,LL>mp;
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("output.out", "w", stdout);
#endif
	int n=read(),h;
	LL ans=0;
	For(i,1,n){
		h=read();
		ans+=mp[h-i];
		mp[-h-i]++;
	}
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;
using ll=long long;

void solve() {
    string s; cin >> s;
    int n = s.size() + 1;
    vector<int> a(n);
    int len = 0;
    for (int i = 1; i < n; i++) {
        if (s[i-1] == '<') len++;
        else len = 0;
        a[i] = len;
    }
    len = 0;
    for (int i = n-2; i >= 0; i--) {
        if (s[i] == '>') len++;
        else len = 0;
        a[i] = max(a[i], len);
    }
    ll sum = 0;
    for(int x:a) sum+=x;
    cout << sum;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 2844
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void solve(){
   int x, y;
   cin >> x >> y;
   while(!(x == 0 && y == 0)){
	   if (x < y) cout << x << " " << y << endl; 
	   else cout << y << " " << x << endl;
	   cin >> x >> y;
	 }
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}



Measured memory_bytes: 3112