akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORE(i,a,b) for(int i=(a);i<=(b);i++)
#define REP(i,b) FOR(i,0,b)
using namespace std;
typedef deque<int> vi;
const int INF=1<<30;
int tar[2]{0,2};
int n,m,num,tmp;
int get(vi use[3],int n){
	REP(i,3)
		REP(j,use[i].size())
			if(use[i][j]==n)
				return i;
}
int search(vi use[3],int goal,int target){
	if(target>n)
	return 0;
	int b=get(use,target);
	int ans=0;
	if(b==tar[goal])
		ans= search(use,goal,target+1);
	else if(b==tar[goal^1]){
		ans+=search(use,goal,target+1);
		ans++;
		use[b].pop_back();
		use[1].push_back(target);
		b=1;
	}
	if(b==1){
		ans+=search(use,goal^1,target+1);
		use[b].pop_back();
		use[tar[goal]].push_back(target);
		ans++;
		ans+=search(use,goal,target+1);
	}
	return ans;
}
int main() {
	while(cin >> n >> m && n){
	vi cups[3];
	REP(i,3){
		cin >> num;
		REP(j,num){
			cin >> tmp;
			cups[i].push_back(tmp);
		}
	}
	int score=INF;
	REP(j,2){
	int target=1,sscore=0;
	vi use[3];
	REP(i,3)
		use[i]=vi(cups[i]);
		sscore+=search(use,j,1);
		score=min(score,sscore);
	}
	if(score>m)
	cout << "-1" << endl;
	else
	cout << score << endl;
	}
	return 0;
}

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

using namespace std;

typedef long long ll;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    for (int i = 1; i <= 9; ++i) {
        for (int j = 1; j <= 9; ++j) {
            if (i * j == n) {
                cout << "Yes";
                return 0;
            }
        }
    }
    cout << "No";
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		System.out.println(c+" "+a+" "+b);

	}

}


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

	class AOJ0595{
		//責任者は絶対にこなきゃだめ
		int n;
		int[][] dp;

		void print(){
			for(int i=0;i<=n;i++){
				for(int s=0;s<7;s++)System.out.print(dp[i][s]+" ");
				System.out.println();
			}
			System.out.println("*******");
		}

		void doIt(){
			n = in.nextInt();
			String sekinin = in.next();
			char[] seki = sekinin.toCharArray();
			dp = new int[n+1][7];//joi,jo,oi,ji,j,o,i,
			HashMap<Character,ArrayList<Integer>> from = new HashMap<Character, ArrayList<Integer>>();
			dp[0][0]=1;dp[0][1]=1;dp[0][3]=1;dp[0][4]=1;
			from.put('J',new ArrayList<Integer>());
			from.put('O',new ArrayList<Integer>());
			from.put('I',new ArrayList<Integer>());
			from.get('J').add(0);from.get('J').add(1);from.get('J').add(3);from.get('J').add(4);
			from.get('O').add(0);from.get('O').add(1);from.get('O').add(2);from.get('O').add(5);
			from.get('I').add(0);from.get('I').add(2);from.get('I').add(3);from.get('I').add(6);
			HashMap<Integer,ArrayList<Integer>> go = new HashMap<Integer, ArrayList<Integer>>();
			go.put(0, new ArrayList<Integer>());go.put(1, new ArrayList<Integer>());go.put(2, new ArrayList<Integer>());
			go.put(3, new ArrayList<Integer>());go.put(4, new ArrayList<Integer>());go.put(5, new ArrayList<Integer>());
			go.put(6, new ArrayList<Integer>());
			for(int i=0;i<7;i++)go.get(0).add(i);
			for(int i=0;i<6;i++)go.get(1).add(i);
			for(int i=0;i<7;i++)if(i!=4)go.get(2).add(i);
			for(int i=0;i<7;i++)if(i!=5)go.get(3).add(i);
			go.get(4).add(0);go.get(4).add(1);go.get(4).add(3);go.get(4).add(4);
			go.get(5).add(0);go.get(5).add(1);go.get(5).add(2);go.get(5).add(5);
			go.get(6).add(0);go.get(6).add(2);go.get(6).add(3);go.get(6).add(6);

			//			for(int i=0;i<7;i++)System.out.println(go.get(i));
			for(int i=0;i<n;i++){
				ArrayList<Integer> list = from.get(seki[i]);//責任者
				for(int s=0;s<list.size();s++)if(dp[i][list.get(s)]>0){//責任者のいる所の中で
					for(int k=0;k<go.get(list.get(s)).size();k++){
						dp[i+1][go.get(list.get(s)).get(k)]+=dp[i][list.get(s)];
						dp[i+1][go.get(list.get(s)).get(k)] = dp[i+1][go.get(list.get(s)).get(k)]%10007; 
					}
				}
			}	
//			print();
			int result = 0;
//			System.out.println(seki[n-1]);
//			System.out.println(from.get(seki[n-1]));
			for(int s=0;s<from.get(seki[n-1]).size();s++){
				result += (dp[n-1][from.get(seki[n-1]).get(s)]);
			}
			System.out.println(result%10007);
		}
	}
}

Measured memory_bytes: 21188
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
#define fr(i,n) for(int i=0;i<n;i++)

int main(){
  string s;
  cin >> s;
  int n[26][100]={0},temp,m[26],kaisu[26];
  fr(i,26){
    temp = 0;
    fr(j,s.size()){
      if(s[j] == ('a'+i)) temp++;
      else n[i][temp]++;//cout << i << " " << temp << " " << n[i][temp] << endl;}
    }
    m[i] = temp;
  }
  fr(i,26){
    fr(j,m[i]+1) kaisu[i] = max(kaisu[i],n[i][j]);
  }
  sort(kaisu,kaisu+26);
  cout << kaisu[0];
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(ll i=0;i<n;++i)
#define ocut cout
#define ouct cout
#define itn int
ll gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

ll lcm(int a, int b)
{
   return a * b / gcd(a, b);
}
struct Union{
  vector<ll> par;
  Union(ll a){
  par=vector<ll>(a,-1);
  }
  ll find(ll a){
    if(par[a]<0){
      return a;
    }
    else{
      return par[a]=find(par[a]);
    }
  }
  bool same(ll a,ll b){
    return (find(a)==find(b));
  }
  ll size(ll a){
    return -par[find(a)];
  }
  void unite(ll a,ll b){
    ll c=find(a),d=find(b);
    if(c==d)
      return;
    if(size(c)<size(d)){
      swap(c,d);
    }
    par[c]+=par[d];
    par[d]=c;
  }
};
int main(){
  ll k,n;
  cin >> k >> n;
  ll y=0,z;
  ll a[n];
  rep(i,n){
    cin >> a[i];
  }
  sort(a,a+n);
  rep(i,n){
    if(i==n-1){
      z=k+a[0]-a[n-1];
      if(y<z)y=z;
    }
    else{
      z=a[i+1]-a[i];
      if(y<z)y=z;
    }
  }
  cout << k-y;
}

Measured memory_bytes: 1792
N = int(input())
Hs = list(map(int, input().split()))

max_cnt = 0
cnt = 0
for i in range(N-1):
    if Hs[i] < Hs[i+1]:
        max_cnt = max(max_cnt, cnt)
        cnt = 0
    else:
        cnt += 1
print(max(max_cnt, cnt))

Measured memory_bytes: 14228
#include <stdio.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <memory.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
typedef long long ll;
int main()
{
	int n;
	scanf("%d", &n);
	vector<int> a(n), b(n);
	int A = 0, B = 0;
	ll s1 = 0, s2 = 0;
	for (auto &x : a) {
		scanf("%d", &x);
		A ^= x & 1;
		s1 += x;
	}
	for (auto &x : b) {
		scanf("%d", &x);
		B ^= x & 1;
		s2 += x;
	}
	if (a == b) {
		puts("Yes");
		return 0;
	}
	if (s1 >= s2) {
		puts("No");
		return 0;
	}
	ll o1 = 0, o2 = 0;
	for (int i = 0; i < n; ++i) {
		if (a[i] < b[i]) {
			int diff = b[i] - a[i];
			o1 += (diff + 1) / 2;
			if (diff & 1)
				++o2;
		}
		else if (a[i] > b[i]) {
			o2 += a[i]-b[i];
		}
	}
	if (o1 >= o2)
		puts("Yes");
	else
		puts("No");
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define loop(i,a,b) for(i=a;i<b;i++)
#define rloop(i,a,b) for(i=a;i>=b;i--)
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
const int inf=1000000001;
const ll INF=1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846

int main(){
	int n,i;
	cin>>n;
	vi a(n);
	loop(i,0,n){
		cin>>a[i];
	}
	vi b(a);
	ll sum1,sum2,cnt1,cnt2;
	sum1=sum2=cnt1=cnt2=0;
	loop(i,0,n){
		if(i%2==0){
			if(sum1+a[i]<=0){
				cnt1+=1-(sum1+a[i]);
				sum1=1;
			}else{
				sum1+=a[i];
			}
		}else{
			if(sum1+a[i]>=0){
				cnt1+=(sum1+a[i])+1;
				sum1=-1;
			}else{
				sum1+=a[i];
			}
		}
	}
	loop(i,0,n){
		if(i%2==0){
			if(sum2+a[i]>=0){
				cnt2+=1+(sum2+a[i]);
				sum2=-1;
			}else{
				sum2+=a[i];
			}
		}else{
			if(sum2+a[i]<=0){
				cnt2+=1-(sum2+a[i]);
				sum2=1;
			}else{
				sum2+=a[i];
			}
		}
	}
	cout<<min(cnt1,cnt2)<<endl;
}

Measured memory_bytes: 1024
def main():
  N = int(input())
  s = []
  for _ in range(N):
    s.append(input())
  M  = int(input())
  t = []
  for _ in range(M):
    t.append(input())
  
  su = list(set(s))
  ans = 0
  for row in su:
    point = s.count(row) - t.count(row)
    if ans < point:
      ans = point
  print(ans) 

main()

Measured memory_bytes: 3060
#include <stdio.h>

int main()
{
  unsigned long N, min = 1000000000000000;
  unsigned long A;
  scanf("%ld",&N);
  for ( int i = 0; i < 5; i++ ) {
    scanf("%ld",&A);
    if ( A < min ) min = A;
  }
  unsigned long ans;
  if ( min >= N ) {
    ans = 5;
  } else if ( N % min == 0 ) {
    ans = N / min + 4;
  } else {
    ans = N / min + 5;
  }
  printf("%ld\n",ans);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define si(n) scanf("%d",&n);
#define PI acos(-1.0)
#define sl(n) scanf("%lld",&n);
#define sf(n) scanf("%lf",&n);
#define ss(n) scanf("%s",n);
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forc(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define sor(n) sort(n.begin(),n.end())
#define sorcmp(n) sort(n.begin(),n.end(),cmp)
#define rev(n) reverse(n.begin(),n.end())
#define pi(x)  printf("%d",x);
#define pl(x)  printf("%lld",x);
#define pf(x)  printf("%.10lf",x);
#define ps(x)  printf("%s",x);
#define en() printf("\n");
#define random_shuffle(r...)random_shuffle(r,[](int _){return rand()%_;})
#define SQR(a) (a)*(a)
#define sp(x) fixed<<setprecision(x)
#define mod 1000000007
#define endl '\n'
#define pii pair<int,int>
#define pll pair<ll,ll>
#define bug cout<<"Here"<<endl
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
template <typename T> T POW(T B,T P){ if(P==0) return 1; if(P&1) return B*POW(B,P-1);  else return SQR(POW(B,P/2));}
ll powmod(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%mod;a = a*a%mod;b >>= 1;}return ans;}


int main()
{

     ll n;
     cin>>n;
     ll arr[n];
     ll sum=0;
     for(int i=0;i<n;i++) cin>>arr[i],sum+=arr[i];

     sum%=mod;

     sum*=sum;
     sum%=mod;

     ll is=0;

     for(int i=0;i<n;i++) is+= arr[i]*arr[i],is%=mod;


     ll ans=sum-is;
     ans+=mod;
     ans%=mod;


     ll fin=powmod(2LL,mod-2);

     ans=(ans%mod)*(fin%mod);
     ans%=mod;
     cout<<ans<<endl;











	return 0;
}


Measured memory_bytes: 5148
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>

using ll = long long;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, x) for(int i=1;i<=(int)(x);i++)
#define rrep(i, x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i, x) for(int i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define srtarr(x, n) sort(x, x+n)
#define dsrtarr(x, n) sort(x, x+n, greater<>());
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007

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

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

using namespace std;
/* 1..10
 * rep:   0 1 2 3 4 5 6 7 8 9
 * reps:  1 2 3 4 5 6 7 8 9 10
 * rrep:  9 8 7 6 5 4 3 2 1 0
 * rreps: 10 9 8 7 6 5 4 3 2 1
 */
const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; 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;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll fact(ll k){
    ll sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
        sum %= MOD;
    }
    return sum;
}
int main() {
    int n, k, r;
    cin >> n >> k;
    COMinit();
    r = n - k;
    reps(i, k) {
        cout << COM(r + 1, i) * COM(k-1, i - 1) % MOD << endl;
    }
}




Measured memory_bytes: 12160
//use itertools::Itertools;
use std::cmp;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use std::io::Read;
use std::usize::MAX;

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

fn solve() {
    input! {
        n: usize,
        m: usize,
        x: usize,
        book: [(usize,[usize;m]);n]
    }

    let mut min_money = MAX;

    //println!("{:?}", book);

    for i in 0..1 << n {
        let mut money = 0;
        let mut rikaido = vec![0; m];
        for j in 0..n {
            if (i >> j) & 1 == 1 {
                money += book[j].0;

                for k in 0..m {
                    rikaido[k] += book[j].1[k];
                }
            }
        }

        let mut ok = true;

        for i in 0..m {
            if rikaido[i] < x {
                ok = false;
            }
        }

        if ok {
            min_money = cmp::min(min_money, money);
        }
    }

    if min_money == MAX {
        println!("{}", -1);
    } else {
        println!("{}", min_money);
    }
}

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();

    /*
    // 入力を一括で読み込む場合
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut input = buf.split_whitespace();

    // inputに対しnext()で読み込んでいく
    let q: usize = input.next().unwrap().parse().unwrap();
    */
}

const LARGE_PRIME: u64 = 1_000_000_007;

// @〜でsnippet


Measured memory_bytes: 2252
#include <bits/stdc++.h>
 
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef double lf;
typedef long double llf;
typedef std::pair<int,int> pii;
#define xx first
#define yy second
#define mp(a,b) std::make_pair(a,b)
#define pb push_back
template<typename T> inline T max(T a,T b){return a>b?a:b;}
template<typename T> inline T min(T a,T b){return a<b?a:b;}
template<typename T> inline T abs(T a){return a>0?a:-a;}
template<typename T> inline T gcd(T a,T b){T t;if(a<b){while(a){t=a;a=b%a;b=t;}return b;}else{while(b){t=b;b=a%b;a=t;}return a;}}

#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
const int MOD = 1e9 + 7;

//unsigned seed = chrono::system_clock::now().time_since_epoch().count();
//mt19937 rng (seed);


int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  
  unsigned long long h,w;
  cin >> h >> w;
  if(h == 1 || w == 1) {cout<<1<<endl;return 0;}
  unsigned long long hw = h*w;
  cout << (hw+1)/2 << endl;
  
}

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

void selectionSort(int A[], int N);
void trace(int A[], int N);

int main(void)
{
	int N;
	int A[100];
	cin >> N;
	for(int i = 0; i < N; i++)
		cin >> A[i];

	selectionSort(A,N);

	return 0;
}

void selectionSort(int A[], int N)
{
	int count = 0;
	for(int i = 0; i < N - 1; i++)
	{
		int minj = i;
		for(int j = i; j < N; j++)
		{
			if(A[j] < A[minj])
			{
				minj = j;
			}
		}
		swap(A[i], A[minj]);
		if(i != minj)
			count++;
	}
	trace(A,N);
	cout << count << endl;
}

void trace(int A[], int N)
{
	for(int i = 0; i < N; i++)
	{
		if(i > 0)
			cout << " ";
		cout << A[i];
	}
	cout << "\n";
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define PI acos(-1)
#define int long long int
#define MOD (ll) (1e9+7)
#define in_arr(ar) for(int i=0;i<sizeof(ar)/sizeof(ar[0]);i++)cin>>ar[i];
#define val(x) cout<<"Value of "<<(#x)<<" is "<<x<<endl;




//ll bigmod(ll a, ll e)
//{
//    ll ret = 1LL;
//    while (e>0)
//    {
//        if (e%2==1) ret = ret * a % MOD;
//        a = a*a % MOD;
//        e/=2;
//    }
//    return ret;
//}

int vis[1000000];

int solve()
{
    int n,k;
    cin>>n>>k;
    int ar[n];
    in_arr(ar);
    sort(ar,ar+n);
    int sum=0;
    for(int i=0;i<k;i++)
    {
        sum+=ar[i];
    }
    cout<<sum<<endl;
    return 0;
}


main()
{
    int t=1;
//    cin>>t;
    while(t--)
    {
        int x = solve();
    }
//    return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include <algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;


int main() {
    int n,bi[3][3],unko[3][3];
    rep(i,3){
     	cin >> bi[i][0] >> bi[i][1] >> bi[i][2] ; 
   		unko[i][0] = unko[i][1] = unko[i][2] = 0;
    }
	cin >> n;
    int b;
	rep(i,n){
     	 cin >> b;
      	 rep(j,3){
           rep(k,3){
           		if(bi[j][k]==b){
                 	unko[j][k] = 1; 
                }
           }
         }
    }
    rep(j,3){
           rep(k,3){
           		if(unko[j][k]==0){
                 	break; 
                }
                if(k==2){
                   cout << "Yes";
                   return 0;
                }
           }
     }
     rep(k,3){
           rep(j,3){
           		if(unko[j][k]==0){
                 	break; 
                }
                if(j==2){
                   cout << "Yes";
                   return 0;
                }
           }
     }
     if(unko[0][0]==1 && unko[1][1]==1 && unko[2][2]==1){
      	cout << "Yes";
        return 0;
     }
     if(unko[0][2]==1 && unko[1][1]==1 && unko[2][0]==1){
       cout << "Yes";
        return 0;
     }
	 //cout << bi[1][0];
    cout << "No";
	return 0;
}

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

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

    int numOfCandy = 0;
    rep(i, N) {
        numOfCandy += i + 1;
    }

    // cout << numOfCandy << endl;

    cout << N * (N + 1) / 2 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
using namespace std;

int main()
{
	int N, X;
	cin >> N >> X;

	auto minM = 1001;
	for (auto i = 0; i < N; ++i)
	{
		int m;
		cin >> m;
		X -= m;
		minM = min(m, minM);
	}

	auto result = N + X / minM;
	cout << result << endl;

	return 0;
}


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

using namespace std;

#define _int64 long long

_int64 gcd(_int64 b,_int64 d)
{
  if (d==0) return b;
  else return gcd(d,b%d);
}

int main()
{
  int l,t,ans;
  _int64 i,j,k,a,b,c,d,tmp,tmp1;
  scanf("%d",&t);
  for (l=0;l<t;l++)
  {
    scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
    if ((a<b)||(d<b)) ans=0;
    else
    {
      if (c>=b-1) ans=1;
      else
      {
        tmp1=gcd(b,d);
        tmp=(a-c)%tmp1+c;
        if (tmp==c) tmp+=tmp1;
        //cout<<tmp<<endl;
        if (tmp>=b) ans=1;
        else ans=0;
      }
    }
    if (ans==1) printf("Yes\n");
    else printf("No\n");
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

int n;
int a[100010];
long long sum=0;
int main()
{
  int beforePos=0;
  std::cin>>n;
  for(int i=0;i<n;++i)
  {
    std::cin>>a[i];
    sum+=std::abs(a[i]-beforePos);
    beforePos=a[i];
  }
  sum+=std::abs(a[n-1]);
  
  for(int i=0;i<n;++i)
    std::cout<<sum
    -std::abs(i==0?a[i]:a[i]-a[i-1])
    -std::abs(i==n-1?a[i]:a[i+1]-a[i])
    +std::abs(i==0?a[i+1]:(i==n-1?a[i-1]:a[i+1]-a[i-1]))
    <<std::endl;
  return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = (int)1e7;  
using  p = pair<char,int>;

int main(){
   string s;
   cin >> s;
   int k;
   cin >> k;
   auto sub = set<string>();
   priority_queue<p,vector<p>,greater<p> > v;

   for (int i = 0; i < s.size(); i++)
   {
      v.push(make_pair(s[i],i));
   }
	
   while(!v.empty()){
      auto i = v.top();
      v.pop();
      for (int r = 1; r <= k; r++)
      {
         if(i.second+r>s.size()) break;
         sub.insert(s.substr(i.second,r));
      }
      if(!v.empty()&&i.first!=v.top().first && sub.size()>= k) break; 
   }
  //for(auto i:sub) cout<< i << endl;
  cout << *next(sub.begin(),k-1);

}
  
  

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int n;
int main() {
	cin>>n;
	int a[n/2];
	int b[n/2];
	int A[100010]={0};
	int B[100010]={0};
	int Aa[100010]={0};
	int Bb[100010]={0};
	for (int i=0;i<n/2;i++){
		cin>>a[i]>>b[i];
		A[a[i]]++;
		B[b[i]]++;
		Aa[a[i]]++;
		Bb[b[i]]++;
	}
	sort(A,&A[100011]);
	sort(B,&B[100011]);
	for(int i=0;i<100010;i++){
		if(Aa[i]==Bb[i]&&Aa[i]==A[100010]){
			cout<<n-max(A[100010]+B[100009],A[100009]+B[100010])<<endl;
			return 0;
		}
	}
	cout<<n-(A[100010]+B[100010])<<endl;
	return 0;
}


Measured memory_bytes: 2176
t = [int(input()) for _  in range(5)]
total = 0
amari = []

for ti in t:
    d, m = divmod(ti, 10)
    total += ti - m
    if m > 0:
        amari.append(m)
if amari:
    total += min(amari) + 10 * (len(amari) - 1)
print(total)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			int suuretsu[] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1,
					4, 1, 51 };
			int inputNumber = sc.nextInt();
			System.out.println(suuretsu[inputNumber-1]);
		} finally {
			sc.close();
		}
	}
}


Measured memory_bytes: 21844
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

bool m1[10];
bool m2[10][10];
bool m3[10][10][10];

int main(void){
	char c;
	while((c=getchar())!=10);
	while((c=getchar())!=10){
		c-='0';
		for(char i=0; i<10; i++)if(m1[i]){
			for(char j=0; j<10; j++)if(m2[i][j]){
				m3[i][j][c]=true;
			}
			m2[i][c]=true;
		}
		m1[c]=true;
	}
	uint32_t ans=0;
	for(char i=0; i<10; i++)if(m1[i]){
		for(char j=0; j<10; j++)if(m2[i][j]){
			for(char k=0; k<10; k++)if(m3[i][j][k]){
				//printf("%c%c%c\n", i+48, j+48, k+48);
				ans++;
			}
		}
	}
	printf("%"PRIu32"\n", ans);
}


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

// computational complexity : O(V^3)

const long long int INF = 1e6;
int V,E;// number of (vertices, edges)
vector<vector<long long int>> d;// d[i][j] = shortest distances between i and j

int main(){
    cin >> V >> E;
    d.assign(V, vector<long long int>(V, INF));
    for (int i=0; i<V; i++){
        d[i][i] = 0;
    }

    vector<int> a(E), b(E), c(E);
    for (int i=0; i<E; i++){
        int u, v, w;
        cin >> u >> v >> w;
        u -= 1;
        v -= 1;
        d[u][v] = w;
        d[v][u] = w;

        a[i] = u;
        b[i] = v;
        c[i] = w;
    }

    // naive DP
    for (int k=0; k<V; k++){// potential relay points
        for (int i=0; i<V; i++){
            for (int j=0; j<V; j++){
                d[i][j] = min(
                    d[i][j],// without going through k
                    d[i][k] + d[k][j]// with going through k
                );
            }
        }
    }

    int ans = E;
    for (int i=0; i<E; i++){
        bool used = false;
        for (int j=0; j<V; j++){
            if(d[j][a[i]] + c[i] == d[j][b[i]]) used = true;
        }
        if(used == true) ans -= 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <iomanip>

using namespace std;

typedef long long ll;

const int MAXN = 18;

int n;
int LOG[1 << MAXN];

ll ans;
ll f[2][1 << MAXN][MAXN + 1];
ll g[2][1 << MAXN][MAXN + 1];

string S,s,t;

int popcount(int v)
{
	return v ? popcount(v - (v & -v)) + 1 : 0;
}

int main()
{
	cin >> n >> S;
	LOG[0] = -1;
	for (int i = 1;i < (1 << n);i++)
		LOG[i] = LOG[i >> 1] + 1;
	s = S.substr(0,n);
	reverse(S.begin(),S.end());
	t = S.substr(0,n);
	f[0][0][0] = 1;
	for (int j = 0;j <= n;j++)
	{
		memset(f[~j & 1],0,sizeof(f[~j & 1]));
		memset(g[~j & 1],0,sizeof(g[~j & 1]));
		for (int i = 0,I = 0;i < (1 << n);I = popcount(++i))
		{
			if (j > I)
				continue;
			for (int k = 0;k < n;k++)
			{
				if (f[j & 1][i][k])
				{
					for (int l = LOG[i] + 1;l < n;l++)
						if (t[l] == s[I])
							f[~j & 1][i | (1 << l)][k + (l == k)] += f[j & 1][i][k];
					if (k == LOG[i] + 1)
					{
						for (int l = k + 1;l < n;l++)
							if (t[l] == s[I])
								g[j & 1][i | (1 << l)][k + (l == k)] += f[j & 1][i][k];
					}
					if (t[k] == s[I])
					{
						int K = k + 1;
						while (K < n && (i >> K & 1))
							K++;
						int el = LOG[i] + 1 + (LOG[i] + 1 == k);
						if (K > el)
							g[j & 1][i | (1 << k)][el] += f[j & 1][i][k];
						else
							f[j & 1][i | (1 << k)][K] += f[j & 1][i][k];
					}
				}
				if (g[j & 1][i][k])
				{
					for (int l = LOG[i] + 1;l < n;l++)
						if (t[l] == s[I])
							g[j & 1][i | (1 << l)][k] += g[j & 1][i][k];
					if (t[k] == s[I])
					{
						int K = k + 1;
						while (K < n && (i >> K & 1))
							K++;
						int el = LOG[i] + 1 + (LOG[i] + 1 == k);
						if (K >= el)
							f[~j & 1][i | (1 << k)][el] += g[j & 1][i][k];
						else
							g[~j & 1][i | (1 << k)][K] += g[j & 1][i][k];
					}
				}
			}
		}
		ans += f[j & 1][(1 << n) - 1][n];
	}
	cout << ans << endl; 
	return 0;
} 

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

using namespace std;

using u32 = uint32_t;
using u64 = uint64_t;
using i64 = int64_t;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = (b-1); i >= a; i--)
#define RF0(i,b) RFO(i,0,b)

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

  int N;
  cin >> N;

  vector<int> balls(N);
  unordered_map<int, u64> cnt;

  F0R(i, N) {
    int a;
    cin >> a;

    balls[i] = a;

    auto it = cnt.find(a);
    if (it != cnt.end()) {
      it->second++;
    }
    else {
      cnt[a] = 1;
    }
  }

  u64 all = 0;
  for (auto pair : cnt) {
    all += pair.second * (pair.second - 1) / 2;
  }

  F0R(k, N) {

    cout << (all - cnt[balls[k]] + 1) << '\n';
  }
}


Measured memory_bytes: 8392
#include <iostream>
#include <string>

using namespace std;

int main(int argc, char const *argv[])
{
    string S;
    cin >> S;
    int cnt = (int)S.length();
    for (int i = 0; i < (int)S.length(); i++)
    {
        if (S[i - 1] == S[i])
        {
            cnt--;
            i += 2;
        }

    }
    
    cout << cnt << endl;
    
    return 0;
}

Measured memory_bytes: 1336
#include<bits/stdc++.h>
using namespace std;
#define For(n) for(int i=0;i<n;i++)
#define Forj(n) for(int j=0;j<n;j++)
#define pi 3.141592654
#define hell 1000000007
#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define fix(n) cout << fixed << setprecision(n)
#define in1(n,c) c n;cin>>n
#define in2(a,b,c) c a,b;cin>>a>>b
#define ina(a,n,c) c a[n];rep(i,0,n)cin>>a[i]
#define ins(s) string s;cin>>s
#define mset(a,n) memset(a,n,sizeof a)
#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))
#define rep(i,a,b) for (__typeof((b)) i=(a);i<(b);i++)
#define repp(i,a,b,p) for(__typeof((b)) i=(a);i<(b);i+=p)
#define ren(i,a,b) for(__typeof((a)) i=(a);i>=(b);i--)
#define lbd lower_bound
#define ubd upper_bound
#define ll  long long
#define ull unsigned long long
#define ld long double
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define piii pair<pair<int,int>,int>
#define all(v) (v).begin(), (v).end()
#define sz(x) (ll)x.size()
#define out(n) cout<<n<<" "
#define outl(n) cout<<n<<endl
#define line cout<<endl

int main ()
{
ll a,b;
cin>>a>>b;
ll c;
c=a+b;
if((c)%2==0)
{
    outl((c)/2);
    
}
else 
    out("IMPOSSIBLE");
}


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

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

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

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

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

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

    int X;
    cin >> X;

    if (X == 3 || X == 5 || X == 7){
        print("YES");
    } else {
        print("NO");
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include <cinttypes>
#include <string.h>
#include <bits/stdc++.h>

#define countof(a) (sizeof(a)/sizeof(*a))

#define vi vector<int>
#define vvi vector<vector<int> >
#define pi pair<int,int>
#define fi first
#define se second

#define FOR(var, to)          for (register s64 var = 0; var < (s64)to; var++)
#define FROMTO(var, from, to) for (register s64 var = from; var <= (s64)to; var++)

#define INIT(var) FOR(i,countof(var)) var[i] = 0
#define INPUT(var) FOR(i,countof(var)) var[i] = ri()

#define SORT(v) qsort(v,countof(v),sizeof(*v),int_less)
#define SORTT(v) qsort(v,countof(v),sizeof(*v),int_greater)

#define MOD 1000000007
#define INF (1 << 30)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

using namespace std;

static inline int ri() {
  int a;
  scanf("%d", &a);
  return a;
}

static inline s64 rs64() {
  s64 a;
  scanf("%" SCNd64, &a);
  return a;
}

static inline void wi(int a) {
  printf("%d", a);
}

static inline void wu64(u64 a) {
  printf("%" PRIu64, a);
}

static inline void ws64(s64 a) {
  printf("%" PRId64, a);
}

int int_less(const void *a, const void *b) {
  return (*((const int*)a) - *((const int*)b));
}
int int_greater(const void *a, const void *b) {
  return (*((const int*)b) - *((const int*)a));
}

int main() {
    int h = ri();
    int w = ri();
    int d = ri();
    int a[h][w];
    FOR(i,h)FOR(j,w) a[i][j] = ri()-1;
    
    int q = ri();
    int l[q];
    int r[q];
    FOR(i,q) l[i] = ri()-1, r[i] = ri()-1;
    
    pi addr[h*w];
    FOR(i,h) FOR(j,w) addr[a[i][j]] = pi(i,j);
    
    int data[h*w];
    FOR(i,d) {
        data[i] = 0;
    }
    FROMTO(i,d,h*w-1) {
        data[i] = data[i-d] + abs(addr[i].fi - addr[i-d].fi) +
                              abs(addr[i].se - addr[i-d].se);
    }
    
    FOR(i,q) {
        cout << data[r[i]]-data[l[i]] << endl;
    }
 return 0;
}


Measured memory_bytes: 3328
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
diff = []
for a, b in zip(A, B):
    diff.append(a - b)
if sum(diff) < 0:
    print(-1)
else:
    positive = [i for i in diff if i > 0]
    negative = [i for i in diff if i < 0]
    if len(negative):
        numNegative = count = len(negative)
        sumNegative = sum(negative)
        totalPositive = 0
        for p in sorted(positive, reverse=True):
            count += 1
            sumNegative += p
            if sumNegative > 0:
                break
        print(count)
    else:
        print(0)


Measured memory_bytes: 18356
// Created by sz
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    for (int i = 0; i < n; i++){
        cin >> p[i];
    }
    
    int first = 0, last = 0;
    int sum = k;
    float mx = 0;
    for (int i = 0; i < n; i++){
        last++;
        sum += p[i];
        if(last < k){
            continue;
        }
        if(last>k){
            sum -= p[first];
            first++;
        }
        if(last >= k){
            mx = max(mx, (float)sum  /2);
        }
    }
    cout << fixed << setprecision(7) <<mx << "\n";
    
    return 0;
}


Measured memory_bytes: 1024
l = [int(input())for i in range(5)]
ans = 0
amari = []
for i in l:
    amari.append(i%10)
amamari = []
for j in amari:
    if j == 0:
        amamari.append(0)
    else:
        amamari.append(10-j)    
amarii = sorted(amamari)
sumsum = sum(l)
sumsumamari = sum(amarii[:4])
ans = sumsum+sumsumamari
print(ans)

Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>

int main()
{
  int counter_i;
  int input_num;
  char taro_card[100], hanako_card[100];
  int taro_score = 0, hanako_score = 0;
  scanf("%d", &input_num);

  for(counter_i = 0 ; counter_i < input_num ; counter_i++)
  {
    scanf("%s %s", taro_card, hanako_card);
    if(strcmp(taro_card, hanako_card) == 0)
    {
      taro_score += 1;
      hanako_score += 1;
    }
    else if(strcmp(taro_card, hanako_card) > 0)
      taro_score += 3;
    else
      hanako_score += 3;
  }

  printf("%d %d\n", taro_score, hanako_score);
}



Measured memory_bytes: 2056
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    while(cin>>n>>k)
    {
        long long ans=0;
        if(!k) ans=(long long)n*(long long)n;
        else
        {
            for(int i=k+1; i<=n; i++)
            {
                long long val=(long long)(i-k)*(long long)(n/i),ret=(long long)(n-(long long)(n/i)*(long long)i-(long long)(k-1));
                if(ret<0) ret=0;
                ans+=(val+ret);
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}


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

using namespace std;

const int MAXN = 20005;

int n, p[MAXN], a[MAXN], b[MAXN];

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; i++)
		scanf("%d", &p[i]);
	int now = n * n + 1;
	for(int i = 1; i <= n; i++)
	{
		b[i] = now;
		now -= n;
	}
	a[p[1]] = 1;
	for(int i = 2; i <= n; i++)
		a[p[i]] = a[p[i - 1]] + b[p[i - 1]] - b[p[i]] + 1;
	int mn = a[1];
	for(int i = 2; i <= n; i++)
		mn = min(mn, a[i]);
	if(mn <= 0) mn = -mn + 1;
	for(int i = 1; i <= n; i++)
		a[i] += mn;
	for(int i = 1; i <= n; i++)
		printf("%d ", a[i]);
	printf("\n");
	for(int i = 1; i <= n; i++)
		printf("%d ", b[i]);
	printf("\n");
	return 0;
}


Measured memory_bytes: 896
#define _USE_MATH_DEFINES

#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

int main(){
	
	string str;
	cin >> str;
	
	int x, y;
	cin >> x >> y;
	
	int ind;
	for(ind = 0; ind < str.size(); ind++){
		if(str[ind] == 'F'){
			x--;
		}else{
			break;
		}
	}
	
	bool X[2][20000] = {};
	bool Y[2][20000] = {};
	
	x += 10000;
	y += 10000;
	
	X[0][10000] = true;
	Y[0][10000] = true;
	
	int cnt = 0;
	int stp = 0;
	
	for(; ind < str.size(); ind++){
		//cout << ind << endl;
		if(str[ind] == 'T'){
			if(cnt % 2 == 0){
				for(int i = 0; i < 20000; i++){
					if(X[0][i]){
						//cout << i << " ";
						X[1][i - stp] = true;
						X[1][i + stp] = true;
					}
				}
				for(int i = 0; i < 20000; i++){
					X[0][i] = X[1][i];
					X[1][i] = false;
				}
			}else{
				for(int i = 0; i < 20000; i++){
					if(Y[0][i]){
						//cout << i << " ";
						Y[1][i - stp] = true;
						Y[1][i + stp] = true;
					}
				}
				for(int i = 0; i < 20000; i++){
					Y[0][i] = Y[1][i];
					Y[1][i] = false;
				}
			}
			stp = 0;
			cnt++;
		}else{
			stp++;
		}
	}
	
	if(cnt % 2 == 0){
		for(int i = 0; i < 20000; i++){
			if(X[0][i]){
				X[1][i - stp] = true;
				X[1][i + stp] = true;
			}
		}
		for(int i = 0; i < 20000; i++){
			X[0][i] = X[1][i];
			X[1][i] = false;
		}
	}else{
		for(int i = 0; i < 20000; i++){
			if(Y[0][i]){
				Y[1][i - stp] = true;
				Y[1][i + stp] = true;
			}
		}
		for(int i = 0; i < 20000; i++){
			Y[0][i] = Y[1][i];
			Y[1][i] = false;
		}
	}
	
	if(X[0][x] && Y[0][y]){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
int hash[101];
int main(){
	int a,b,c,ans=0;
	cin>>a>>b>>c;
	hash[a]++;
	hash[b]++;
	hash[c]++;
	for(int i=1;i<=100;i++){
		if(hash[i]!=0){
			ans++;
		}
	}
	cout<<ans;
	return 0;
}


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

int a[110];

int main(){
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n; i++)
		scanf("%d", a + i);
	sort(a, a + n);
	printf("%d\n", a[n-1] - a[0]);
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int a=0;
    int b=0;
    int c=0;
    int d=0;
    long long int ans=0;
    cin>>a>>b>>c>>d;
    for(int i=0;i<=3000;i++)
    {
        if(a*i>d)
            break;
        for(int j=0;j<=3000;j++)
        {
            if(a*i+b*j>d)
                break;
            if((d-a*i-b*j)%c==0)
                ans++;
        }

    }



    cout<<ans;



    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

s = input()
n = len(s)
for i in range(2,n,2):
  if s[:i//2] == s[i//2:i]:
    ans = max(i,ans)
print(ans)

Measured memory_bytes: 3316
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = (0 until n).map { sc.next().toInt() }
    println(problem072c(n, a))
}

fun problem072c(n: Int, a: List<Int>): Int {
    val list = mutableListOf<Int>()
    for (i in 0 until n) {
        list.add(a[i] - 1)
        list.add(a[i])
        list.add(a[i] + 1)
    }
    val map = list.groupBy { it }
    var max = 0
    for (i in map) {
        max = Math.max(max, i.value.size)
    }
    return max
}

Measured memory_bytes: 73608
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;

public static class P
{
    public static void Main()
    {
        var nt = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var n = nt[0];
        var t = nt[1];
        var orders = Enumerable.Repeat(0, n).Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).OrderBy(x => x[0]).ToArray();
        var res = 0;
        int[] maxHappiness = new int[t];
        foreach (var ab in orders)
        {
            var a = ab[0];
            var b = ab[1];
            res = Max(res, maxHappiness.Max() + b);
            for (int j = maxHappiness.Length - 1; j >= a; j--)
                maxHappiness[j] = Max(maxHappiness[j], maxHappiness[j - a] + b);
        }
        Console.WriteLine(res);
    }
}


Measured memory_bytes: 13684
n, a, b = map(int, input().split())

def nCr(n, r):
    r = min(r, n-r)
    num, den = 1, 1
    for i in range(r):
        num = (num * (n-i)) % mod
        den = (den * pow(i+1, mod-2, mod)) % mod
    return num * den % mod

mod = 10**9 + 7
print((pow(2, n, mod) - nCr(n, a) - nCr(n, b) - 1) % mod)

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

int n;
long m, a, c[100010], s, t;

int main(){
	cin >> n >> m;
	c[0] = 0;
	for (int i = 0; i < n; ++i){
		cin >> a;
		c[i+1] = (c[i] + a) % m;
	}
	sort(c, c+n+1);
	s = 0;
	t = 1;
	for (int i = 1; i <= n; ++i){
		if (c[i] == c[i-1]) t++;
		else{
			s += t*(t-1)/2;
			t = 1;
		}
	}
	s += t*(t-1)/2;
	cout << s;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

int main()
{
    int a, b, c, d, e, f;
    double x, y, det;

    while(cin >> a >> b >> c >> d >> e >> f)
    {
        det = (double) (a*e-b*d);
        det = 1.0 /det;
        x = ((double)(c * e - b * f))  * det;
        x = ceil(1000.0*x-0.5) /1000.0;
        y = ((double)(a * f - c * d)) * det;
        y = ceil(1000.0*y-0.5) /1000.0;
        if(abs(x) < 0.0001) x =0.0;
        if(abs(y) < 0.0001) y =0.0;
        printf("%.3lf %.3lf\n", x, y);
    }
    return 0;
}

Measured memory_bytes: 1192
#include <stdio.h>

#define MAX 100
#define INF 1000000
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, M[MAX][MAX];

int prim();

int main() {
  int i, j, e;

  scanf("%d",&n);
  for(i=0;i<n;i++) {
    for(j=0;j<n;j++) {
      scanf("%d",&e);
      M[i][j] = (e==-1) ? INF : e;
    }
  }
  printf("%d\n",prim());

  return 0;
}

int prim(){
  int i, u, v, minv, d[MAX], p[MAX], color[MAX];

  for(i=0;i<n;i++) {
    d[i] = INF;
    p[i] = -1;
    color[i] = WHITE;
  }

  d[0] = 0;

  while(1) {
    minv = INF;
    u = -1;
    for(i=0;i<n;i++){
      if(minv>d[i] && color[i]!=BLACK) {
        u = i;
        minv = d[i];
      }
    }
    if(u==-1) break;
    color[u] = BLACK;
    for(v=0;v<n;v++) {
      if(color[v]!=BLACK && M[u][v]!=INF) {
        if(d[v]>M[u][v]){
          d[v] = M[u][v];
          p[v] = u;
          color[v] = GRAY;
        }
      }
    }
  }
  int sum = 0;
  for(i=0;i<n;i++) if(p[i]!=-1) sum += M[i][p[i]];

  return sum;
}


Measured memory_bytes: 2048
n, t = map(int, input().split())
a = [int(x) for x in input().split()]
m = a[0]
d = 0
c = 1
for x in a:
    if x < m: m = x
    elif x - m == d: c += 1
    elif x - m > d:
        d = x - m
        c = 1
print(c)


Measured memory_bytes: 14292
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <math.h>
typedef long long ll;
using namespace std;

int main() {
	ll n,m;
	cin>>n>>m;
	ll a[n],b[n],c[m],d[m],p=1e9,w;
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
	}
	for(int i=0;i<m;i++){
		cin>>c[i]>>d[i];
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(p>abs(a[i]-c[j])+abs(b[i]-d[j])){
				p=abs(a[i]-c[j])+abs(b[i]-d[j]);
				w=j+1;
			}
		}
		cout <<w<<endl;
		p=1e9;
		w=0;
	}
 	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;

void solve(){
  int r; cin >> r;
  if(r < 1200) cout << "ABC\n";
  else if(r < 2800) cout << "ARC\n";
  else cout << "AGC\n";
  return;
}
int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>

using namespace std;

int main(){
  int N,M,X;
  int ans = 12345678;
  cin >> N >> M >> X;

  vector<int> C(N);
  vector<vector<int> > A(N,vector<int>(M));

  for(int i=0;i < N;i++){
    cin >> C.at(i);
    for(int j=0;j < M;j++) cin >> A.at(i).at(j);
  }

  int all = 1 << N;

  for(int mask = 0;mask < all;mask++){
    vector<int> level(M);
    int cost = 0;
    for(int i=0;i < N;i++){
      if((mask>>i)& 1){
        cost += C[i];
        for(int j=0;j < M;j++) level[j] += A.at(i).at(j);
      }
    }
    bool ok = true;
    for(int j=0;j < M;j++){
      if(level[j] < X) ok = false;
    }
    if(ok) ans = min(ans,cost);
  }
  if(ans == 12345678){
    cout << -1 << endl;
  }else{
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    LL N; cin >> N;
    vector<LL> A(N);
    REP(i,N) cin >> A[i];
    sort(A.begin(), A.end());

    if(N%2 == 1){
        REP(i,N-1)
        {
            if(A[i+1] != 2 * (i/2 + 1))
            {
                cout << 0 << endl;
                return 0;
            }
        }
    }
    else{
        REP(i,N)
        {
            if(A[i] != 2*(i/2)+1)
            {
                cout << 0 << endl;
                return 0;
            }
        }
    }
    LL ans = 1;

    REP(i,N/2)
    {
        ans = (ans * 2) % MOD;
    }
    cout << ans << endl;



}

Measured memory_bytes: 1024
n = int(input())

title = []
time = []

for i in range(n):
    s,t = map(str,input().split())
    title.append(s)
    time.append(int(t))

x = input()

flg = 0
cnt = 0
for i in range(n):
    if flg==0 and title[i] != x:
        continue
    elif flg==1:
        cnt += time[i]
    elif flg==0 and title[i] == x:
        flg = 1
print(cnt)

Measured memory_bytes: 3064