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

/*
問題文

*/

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

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

        int cons[] = new int[n];
        long allCount = 0;

        for (int i = 0; i < cons.length; i++) {
            cons[i] = sc.nextInt();
            allCount += cons[i];
        }

        Arrays.sort(cons);

        int count = 0;
        for (int i = 0; i < m; i++) {
            if (cons[n-1-i] >= allCount / (4.0 * m)) {
                count++;
            }
        }

        String flg = "No";
        if (count == m) {
            flg = "Yes";
        }
        System.out.println(flg);
    }
}

Measured memory_bytes: 23892
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long LL;

int main(){
	char c;
	cin >> c;
	cout << (c >= 'a' ? 'a' : 'A') << endl;
}

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

void call(int n) {
    for (int i = 1; i <= n; ++i) {
        int x = i;
        if (x % 3 == 0) {
            cout << " " << i;
            continue;
        }
        while (x) {
            if (x % 10 == 3) {
                cout << " " << i;
                break;
            }
            x /= 10;
        }
    }
    cout << endl;
}

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

    return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <string>
#include <vector>
#define range(i,r) for(int i=0;i<r;i++)
#define INF 1e9
using namespace std;
std::vector<int> L;
int N, A, B, C;
int dfs(int cur, int a, int b, int c){
  if(cur == N){
    if(min(a, min(b, c)) > 0){
      return abs(a - A) + abs(b - B) + abs(c - C) - 30;
    }else{
      return INF;
    }
  }
  int ret0 = dfs(cur + 1, a, b, c);
  int ret1 = dfs(cur + 1, a + L[cur], b, c) + 10;
  int ret2 = dfs(cur + 1, a, b + L[cur], c) + 10;
  int ret3 = dfs(cur + 1, a, b, c + L[cur]) + 10;
  return min(ret0, min(ret1, min(ret2, ret3)));
}
int main(int argc, char const *argv[]) {
  std::cin >> N >> A >> B >> C;
  range(i,N) {
    int temp;
    std::cin >> temp;
    L.push_back(temp);
  }
  std::cout << dfs(0, 0, 0, 0) << '\n';
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        int min = 0;

        if ((a + b) >= n)
            min = (a + b) - n;

        int max = a < b ? a : b;
        System.out.println(max + " " + min);
    }        
}

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

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
  read::<String>().split_whitespace()
    .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
  (0..n).map(|_| read_vec()).collect()
}

fn main() {
  let n: i8 = read();
  let tmp = read_vec::<String>();
  let (s, t) = {
    (&tmp[0], &tmp[1])
  };

  let s: Vec<char> = s.chars().collect();
  let t: Vec<char> = t.chars().collect();

  let mut ans: String = "".to_string();
  for i in 0..s.len() {
    ans.push_str(&(s[i].to_string()));
    ans.push_str(&(t[i].to_string()));
  }

  println!("{}", ans);
}

Measured memory_bytes: 4352
N,K,Q=map(int,input().split())
A=[int(input())for i in range(Q)]
point=[-Q+K]*N
for i in range(Q):
    point[A[i]-1]+=1
for j in range(N):
    if point[j]>0:
        print('Yes')
    else:
        print('No')
    

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

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

fn main() {
    let n = read::<usize>();
    let mut ds = vec![0; n];
    for i in 0..n {
        ds[i] = read::<usize>();
    }
    ds.sort();
    let ans = ds[n / 2] - ds[n / 2 - 1];
    println!("{}", ans);
}


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

int main() {
    int N;
    int l, r;
    int i;
    int sum = 0;
    cin >> N;
    for(i = 0;i < N;i++) {
        cin >> l >> r;
        sum += r - l + 1;
    }
    cout << sum << endl;
}


Measured memory_bytes: 256
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;

typedef long long ll;
//typedef pair<int,int> Pint;
//typedef pair<ll, ll> P;
//typedef pair<ll, pair<ll, ll>> P;
//typedef tuple<int,int,int> T;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define revrep(i, n) for(ll i = n-1; i >= 0; i--)
#define pb push_back
#define f first
#define s second
ll INFL = 1LL << 60;//10^18 = 2^60
int INF = 1 << 30;//10^9
ll MOD = 1e9 + 7;
//ll MOD  = 998244353;
vector<ll> dy = {0, 0, 1, -1, 1, 1, -1, -1, 0};
vector<ll> dx = {1, -1, 0, 0, 1, -1, 1, -1, 0};

ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll pow_long(ll x, ll k){
  ll res = 1;
  while(k > 0){
    if(k % 2) res *= x;
    x *= x;
    k /= 2;
  }
  return res;
}

ll pow_mod(ll x, ll k){
  x %= MOD; x += MOD; x %= MOD;
  ll res = 1;
  while(k > 0){
    if(k % 2){
      res *= x; res %= MOD;
    }
    x *= x; x %= MOD;
    k /= 2;
  }
  return res;
}
ll inverse(ll x){return pow_mod(x, MOD - 2);};

ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}
ll lcm(ll x, ll y){return x / gcd(x, y) * y % MOD;};

int main(){
  int N, D; cin >> N >> D;
  ll X[N][D];
  rep(i, N)rep(j, D) cin >> X[i][j];

  ll cnt = 0;

  rep(i, N)rep(j, N){
    if(i == j) continue;
    ll sum = 0;
    rep(k, D){
      sum += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
    }
    if((int)sqrt(sum) * (int)sqrt(sum) == sum) cnt++;
  }

  cout << cnt / 2 << endl;


















}


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

const int N = 1e5 + 100;

int n, num, ans, cnt[N];

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n;
	while(n--) {
		cin >> num;
		if(num >= N)
			ans++;
		else
			cnt[num]++;
	}
	for (int i = 1; i < N; i++)
		if(cnt[i] < i)
			ans += cnt[i];
		else
			ans += cnt[i] - i;
	cout << ans;
	return 0;
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n;
    cin >> n;
    if(n <= 26){
        char ans = 'a' + n - 1;
        cout << ans << endl;
        return 0;
    }
    vector<ll> v(20,1e18);
    ll tmp = 26;
    v.at(0) = tmp;
    for(i = 1;i < 20;++i){
        v.at(i) = tmp*26 + v.at(i-1);
        tmp *= 26;
        if(v.at(i) >= 1e16) break;
    }
    for(i = 0;i < 20;++i){
       if(n <= v.at(i)) break; 
    }
    n -= v.at(i-1) + 1;
    vector<char> ans(i+1);
    for(i = 0;i < ans.size();++i){
        ans.at(i) = n%26 + 'a';
        n /= 26;
    }
    for(i = ans.size()-1;i >= 0;--i) cout << ans.at(i);
    cout << endl;
    return 0;
}

Measured memory_bytes: 3616
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <vector>
#define rep(i,st,ed) for (int i=st;i<=ed;++i)
#define fi first
#define se second

typedef std:: pair <int,int> pair;
const int MOD=1e9+7;
const int N=305;

int f[N][N][N];

std:: vector <pair> vec[N];

int read() {
	int x=0,v=1; char ch=getchar();
	for (;ch<'0'||ch>'9';v=(ch=='-')?(-1):v,ch=getchar());
	for (;ch<='9'&&ch>='0';x=x*10+ch-'0',ch=getchar());
	return x*v;
}

void upd(int &x,int v) {
	x+=v; (x>=MOD)?(x-=MOD):0;
}

int main(void) {
	int n=read(),m=read();
	rep(i,1,m) {
		int l=read(),r=read(),x=read();
		vec[r].push_back(pair(l,x));
	}
	f[1][0][0]=3;
	rep(i,1,n-1) {
		rep(j,0,i) {
			rep(k,0,j) {
				if (!f[i][j][k]) continue;
				for (int t=0;t<vec[i].size();++t) {
					int l=vec[i][t].fi,x=vec[i][t].se;
					if ((x==1)&&(l<=j)) {f[i][j][k]=0; break;}
					if ((x==2)&&(l<=k||l>j)) {f[i][j][k]=0; break;}
					if ((x==3)&&l>k) {f[i][j][k]=0; break;}
				}
				if (!f[i][j][k]) continue;
				upd(f[i+1][j][k],f[i][j][k]);
				upd(f[i+1][i][j],f[i][j][k]);
				upd(f[i+1][i][k],f[i][j][k]);
			}
		}
	}
	int ans=0;
	rep(j,0,n) rep(k,0,j) {
		if (!f[n][j][k]) continue;
		for (int t=0;t<vec[n].size();++t) {
			int l=vec[n][t].fi,x=vec[n][t].se;
			if ((x==1)&&(l<=j)) {f[n][j][k]=0; break;}
			if ((x==2)&&(l<=k||l>j)) {f[n][j][k]=0; break;}
			if ((x==3)&&l>k) {f[n][j][k]=0; break;}
		}
		if (!f[n][j][k]) continue;
		upd(ans,f[n][j][k]);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 108800
#include<cstdio>
#include<cctype>


int main(){
    char ch;


    while(1){
        scanf("%c",&ch);

        if(isalpha(ch)){
            
            if(islower(ch)){
                printf("%c" ,toupper(ch));
            }
            
            else{
                printf("%c" ,tolower(ch));
            }
        }
            
        else{
            printf("%c",ch);

        }
        
        if ( ch == '\n' ) break;
    
    }
    return 0;
}


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

int selectionSort(int A[],int n){
	int num = 0;
	for(int i=0;i<n;i++){
		int min_num = i;
		for(int j=i+1;j<n;j++){
			if(A[min_num]>A[j]){
				min_num = j;
			}
		}
		if(i!=min_num){
			swap(A[i],A[min_num]);
			num++;
		}
	}
	return num;
}

int main(){
	int n;
	cin>>n;
	int A[n];
	for(int i=0;i<n;i++){
		cin>>A[i];
	}
	int as = selectionSort(A,n);
	for(int i=0;i<n;i++){
		if(i)
			cout<<" ";
		cout<<A[i];
	}
	cout<<endl;
	cout<<as<<endl;
	return 0;
}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
const int MAX=1e5+1;
int dp[MAX],a[101],n,k;
int main()
{   cin>>n>>k;
    memset(dp,0,sizeof(dp));
    for(int i=0;i<n;i++){cin>>a[i];dp[a[i]]=1;}
    for(int i=0;i<=k;i++)
    {
        for(int j=0;j<n;j++)
        {
            if(i>a[j]&&dp[i-a[j]]==0)
                dp[i]=1;
        }
    }
    (dp[k])?cout<<"First":cout<<"Second";


}


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


Measured memory_bytes: 128
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    ll k;
    cin >> s >> k;
    int i = 0;
    while(s[i] == '1' && i < s.size())
    {
        if(i == k - 1)
        {
            cout << 1;
            return 0;
        }
        i++;
    }
    cout << s[i];

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[10002];
        for (int x = 1 ; x <= 100 ; x++) {
            for (int y = 1 ; y <= 100 ; y++) {
                for (int z = 1 ; z <= 100 ; z++) {
                    if (x * x + y * y + z * z + x * y + y * z + z *x <= n) {
                        a[x * x + y * y + z * z + x * y + y * z + z *x]++;
                    }
                }
            }
        }
        for (int i = 1 ; i <= n ; i++) {
            System.out.println(a[i]);
        }
    }

}


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

int main() {
  string S;
  cin>>S;
  int ans=0;
  string halfS;
  for(int i=1;i<S.size()/2;i++){
    halfS=S.substr(0,i)+S.substr(0,i);
    if(halfS==S.substr(0,i*2))
      ans=i*2;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3592
while True:
    n,m=map(int,input().split())
    if n==m==0:
        break
    cata=list(map(int,input().split()))
    max=0
    sum=0
    for i in range(n):
        for j in range(i+1,n):
            sum=cata[i]+cata[j]
            if sum<=m and sum>max:
                max=sum
    if max==0:
        print('NONE')
    else:
        print(max)


Measured memory_bytes: 5624
import sys
n = int(input())
a = list(map(int,input().split()))

for i in range(n):
    if a[i]%2 == 0:
        if a[i]%3 != 0 and a[i]%5 != 0:
            print("DENIED")
            sys.exit()
    
print("APPROVED")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))
#define push_back pb
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

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

int main() {
	int N;
	string S;
	cin>>N>>S;
	//iまで見たときのBの個数、Wの個数
	vector<int> B(N),W(N);
	int bcnt = 0, wcnt = 0;
	rep(i,N){
		if(S[i]=='.'){
			wcnt++;
		}
		else{
			bcnt++;
		}
		W[i] = wcnt;
		B[i] = bcnt;
	}
	int ans = INF;
	//iまで全て.にして、それ以降全て#にするのにかかる工程数
	//print(W);print(B);
	//cout<<W.size()<<B.size()<<endl;
	rep(i,N){
		int n = 0;
		n += B[i];
		n += wcnt - W[i];
		ans = min(ans,n);
	}
	ans = min(ans,N-bcnt);
	ans = min(ans,N-wcnt);
	if(bcnt == N)ans = 0;
	if(wcnt == N)ans = 0;

	cout<<ans<<endl;
}

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

int main(){
	
	int k,a,b;cin>>k>>a>>b;
	int j{};
	while(1){
		if(a<=j&&j<=b){
			cout << "OK"<<endl;
			return 0;
		}
		if(j>b){
			cout << "NG"<<endl;
			return 0;
		}
		j += k;
	}
	
	
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  ll n,m;
  cin >> n >> m;
  vll a(m);
  REP(i, m)
    cin >> a[i];
  
  sort(a.begin(), a.end());
  vll numToMatch(10);
  string s = "0255456376";
  REP(i, 10)
    numToMatch[i]=s[i]-'0';
  
  vll dp(n+1, -LLINF);
  dp[0] = 0;
  REP(i, n+1){
    REP(j, m){
      ll amount = numToMatch[a[j]];
      if(i-amount<0)
        continue;
      if(dp[i-amount] != -LLINF)
        dp[i] = max(dp[i], dp[i-amount]+1);
    }
  }
  
  while(n>0){
    ll num=0;
    REP(i, m){
      ll amount = numToMatch[a[i]];
      if(dp[n-amount] != -LLINF && dp[n]-dp[n-amount] == 1)
        num = max(num, a[i]);
    }
    cout << num;
    ll amount = numToMatch[num];
    n -= amount;
  }
  
  cout << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T & a, T b) { if (a < b)a = b; }
template<class T>void chmin(T & a, T b) { if (a > b)a = b; }
constexpr int INF = 1000000000000000000;
constexpr int mod = 1000000007;
int dx[] = { 0,1,0,-1 }, dy[] = { 1,0,-1,0 };
int kaijo[2000010];
struct edge { int to, cost; };
int gcd(int a, int b) {
    if (b == 0)return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a / gcd(a, b) * b;
}
bool prime(int a) {
    if (a == 1)return false;
    for (int i = 2; i * i <= a; i++) {
        if (a % i == 0)return false;
    }
    return true;
}
void init_fact() {
    kaijo[0] = 1;
    for (int i = 1; i <= 2000000; i++) {
        kaijo[i] = kaijo[i - 1] * i;
        kaijo[i] %= mod;
    }
}
int modpow(int a, int b) {
    if (b == 0)return 1;
    if (b % 2)return modpow(a, b - 1) * a % mod;
    int memo = modpow(a, b / 2);
    return memo * memo % mod;
}
int comb(int a, int b) {
    if (!kaijo[0])init_fact();
    return kaijo[a] * modpow(kaijo[a - b], mod - 2) % mod * modpow(kaijo[b], mod - 2) % mod;
}
int inv(int x) {
    x = modpow(x, mod - 2);
    return x;
}
bool kosa(double ax, double ay, double bx, double by, double cx, double cy, double dx, double dy) {
    double ta = (cx - dx) * (ay - cy) + (cy - dy) * (cx - ax);
    double tb = (cx - dx) * (by - cy) + (cy - dy) * (cx - bx);
    double tc = (ax - bx) * (cy - ay) + (ay - by) * (ax - cx);
    double td = (ax - bx) * (dy - ay) + (ay - by) * (ax - dx);
    return tc * td < 0 && ta * tb < 0;
}
double dist(double ax, double ay, double bx, double by) {
    return sqrt((bx - ax) * (bx - ax) + (ay - by) * (ay - by));
}
int a[3][3];
bool f[3][3];
signed main() {
    rep(i, 3)rep(j, 3)cin >> a[i][j];
    int n;
    cin >> n;
    rep(i, n) {
        int b;
        cin >> b;
        rep(j, 3) {
            rep(k, 3) {
                if (a[j][k] == b)f[j][k] = true;
            }
        }
    }
    bool ans = false;
    rep(i, 3) {
        if (f[i][0] && f[i][1] && f[i][2])ans = true;
        if (f[0][i] && f[1][i] && f[2][i])ans = true;
    }
    if (f[0][0] && f[1][1] && f[2][2])ans = true;
    if (f[2][0] && f[1][1] && f[0][2])ans = true;
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define MOD 1e9 + 7
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
 
int main() {
    string s;
    while(getline(cin, s)){
    	rep(i, 26) {
	    	rep(j, s.size()) {
	            if('a' <= s[j] && s[j] < 'z') s[j] = s[j] + 1;
	            else if(s[j] == 'z') s[j] = 'a';
	        }
	        if(s.find("the") != string::npos || s.find("this") != string::npos || s.find("that") != string::npos){
                cout << s << endl;
            }
	    }
    }
    return 0;
}

Measured memory_bytes: 2956
#include <stdio.h>
#include <stdlib.h>

typedef long long int lli;

int cmp(const void *a, const void *b) {
    lli x = (* (lli *)a), y = (* (lli *)b);

    if (x < y) {
      return 1;
    } else if (x > y) {
      return -1;
    } else {
      return 0;
    }
}

int main(int argc, char const *argv[]) {
  unsigned int n, k;
  lli *t, c = 0;

  scanf("%u %u", &n, &k);
  t = malloc(sizeof(lli) * n);

  for (size_t i = 0; i < n; i++) {
    scanf("%lli", &t[i]);
  }

  qsort(t, n, sizeof(lli), cmp);

  for (size_t l = 0; l < k; ++l) {
    c += t[l];
  }

  printf("%lli\n", c);

  free(t);
  return 0;
}


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

typedef long long ll;
ll I, O, T, J, L, S, Z;
ll ans = 0, tmp = 0;

int main() {
    cin>>I>>O>>T>>J>>L>>S>>Z;

    ans += 2*O;
    ans += 4*(I/2);
    ans += 4*(J/2);
    ans += 4*(L/2);

    if(I && J && L) {
        tmp += 6;
        I--;
        J--;
        L--;
        tmp += 2*O;
        tmp += 4*(I/2);
        tmp += 4*(J/2);
        tmp += 4*(L/2);
    }


    cout<<max(ans, tmp)/2;
}


Measured memory_bytes: 256
while 1:
    m, f, r = map(int, 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 65<= m+f  < 80:
        print('B')
    elif 50 <= m+f < 65:
        print('C')
    elif 30 <= m+f<50:
        if r>=50:
            print('C')
        else:
            print('D')
    elif m+f<30:
        print('F')

    


Measured memory_bytes: 5596
#include<bits/stdc++.h>
using namespace std;
vector<int> primes;
int A[1005];

void f(int a) {
    for(int i = 2; i * i <= a; i++) {
        if(a % i != 0) continue;
        primes.push_back(i);
        while(a % i == 0) a /= i;
    }
    if(a != 1) primes.push_back(a);
}

int main() {
    int N;
    cin >> N;
    for(int i = 1; i <= N; i++) {
        cin >> A[i];
        f(A[i]);
    }
    long long ans = 0;
    for(auto val : primes) {
        long long  now = 0;
        for(int i = 1; i <= N; i++) {
            if(A[i] % val == 0) now += A[i];
        }
        ans = max(ans, now);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3176
def dist(x,y):
    return abs(x[0]-y[0])+abs(x[1]-y[1])
N,M = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(N)]
B = [list(map(int,input().split())) for _ in range(M)]
for i in range(N):
    ind = 0
    dmin = 10**9
    for j in range(M-1,-1,-1):
        if dist(A[i],B[j])<=dmin:
            ind = j+1
            dmin = dist(A[i],B[j])
    print(ind)

Measured memory_bytes: 39664
#include<iostream>
#include<cmath>
#define MOD 1000000007

using namespace std;

long long power(long long a,long long x){
    return x?x%2?power(a,x-1)*a%MOD:(long long)powl(power(a,x/2),2)%MOD:1;
}
long long nCr(long long n,long long r){
    long long nCr=1LL;
    for(long long i=n;i>n-r;nCr%=MOD,i--)nCr*=i;
    for(long long i=1;i<=r;nCr%=MOD,i++)nCr*=power(i,MOD-2);
    return nCr;
}


int main(){
    long long x,y;
    cin>>x>>y;
    long long r=(2*y-x)/3LL,n=r+(y-2*r);
    if((2*y-x)%3!=0LL||r<0||n<=0){cout<<0<<endl;return 0;}

    cout<<nCr(n,r)<<endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

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

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int X = scan.nextInt();
        int Y = scan.nextInt();
        int A = scan.nextInt();
        int B = scan.nextInt();
        int C = scan.nextInt();
        List<Long> p = new ArrayList<>();
        List<Long> q = new ArrayList<>();
        List<Long> r = new ArrayList<>();
        for (int i = 0; i < A; i++) {
            p.add(scan.nextLong());
        }
        for (int i = 0; i < B; i++) {
            q.add(scan.nextLong());
        }
        for (int i = 0; i < C; i++) {
            r.add(scan.nextLong());
        }
        p.sort(Comparator.naturalOrder());
        q.sort(Comparator.naturalOrder());
        PriorityQueue<Long> queue = new PriorityQueue<>(Comparator.reverseOrder());
        for (int i = A - X; i < A; i++) {
            queue.add(p.get(i));
        }
        for (int i = B - Y; i < B; i++) {
            queue.add(q.get(i));
        }
        for (long target : r) {
            queue.add(target);
        }
        long ans = 0;
        for (int i = 0; i < X + Y; i++) {
            ans += queue.poll();
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 101392
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {

	public static void main(String args[]) throws IOException {
		Scanner sc = new Scanner(System.in);

		final int q = sc.nextInt();

		Deque<Integer> list = new ArrayDeque<Integer>(1000000);
		for (int i = 0; i < q; i++) {
			final String ops = sc.next();

			if ("insert".equals(ops)) {
				final int x = sc.nextInt();
				list.addFirst(x);
			} else if ("delete".equals(ops)) {
				final int x = sc.nextInt();
				list.removeFirstOccurrence(x);
			} else if ("deleteFirst".equals(ops)) {
				list.removeFirst();
			} else if ("deleteLast".equals(ops)) {
				list.removeLast();
			}
		}

		boolean first = true;
		for (int i : list) {
			if (first) {
				first = false;
			} else {
				System.out.print(" ");
			}
			System.out.print(i);
		}
		System.out.println();
	}

	public static class Scanner {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

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

int main(){
int N;
string S;
   cin>>N;
   cin>>S;
  
  int ans=0;
  for(int i=1; i<N; i++){
      int count=0;
     for(char c='a'; c<='z'; c++){
         bool left=false, right=false;
         for(int j=0; j<i; j++){ // 左側の探索
           if(S[j]==c){left=true;}
         }
         for(int j=i; j<N; j++){ // 右側の探索
           if(S[j]==c){right=true;}
         } 
     
       if(left && right){count++;} //左右共通の文字があるとcount
     }
      if(ans<count){ans=count;} // 最大のcountをansに入れる
  }
  
  cout<<ans;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int i,sum,n,k,x,y;
	scanf("%d %d %d %d",&n,&k,&x,&y);
	sum=0;
	for(i=1;i<=n;i++){
		if(i<=k) sum+=x;
		else sum+=y;
	}
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
#define repu(i,x,y) for (int i=x; i<=y; ++i)
using namespace std;

typedef long long LL;
int n;
LL f[100100][3];

int getint()
{
    char ch;
    while (!isdigit(ch=getchar()));
    int x=ch-'0';
    for (; isdigit(ch=getchar()); x=x*10+ch-'0');
    return x;
}

int main()
{
    n=getint();
    memset(f,200,sizeof(f)),f[1][0]=getint();
    repu(i,2,n)
    {
        char ch=getchar();
        int x=getint();
        if (ch=='+')
        {
            f[i][0]=max(f[i-1][0]+x,f[i-1][1]-x);
            f[i][1]=max(f[i-1][1]-x,f[i-1][2]+x);
            f[i][2]=f[i-1][2]+x;
        }
        else
        {
            f[i][0]=max(f[i-1][0]-x,f[i-1][1]+x);
            f[i][1]=max(max(f[i-1][0],f[i-1][2])-x,f[i-1][1]+x);
            f[i][2]=max(f[i-1][1]+x,f[i-1][2]-x);
        }
    }
    printf("%lld\n",max(f[n][0],max(f[n][1],f[n][2])));
    return 0;
}

Measured memory_bytes: 2560
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<algorithm>

using namespace std;

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

    if (n % 2 == 0) {
        cout << n << endl;
    } else {
        cout << n * 2 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end());
#define VREV(v) reverse(v.begin(), v.end());
using namespace std;
using ll = long long;
using pll = pair<ll,ll>;
using vll = vector<ll>;
using vdouble = vector<double>;
using vstr = vector<string>;
typedef pair<int,int> P;
int dx[4] = {1, 0, -1, 0},dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
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; }
const ll INF = 1LL << 60;
const ll mod = 1000000007;

int main(){
	ll N;cin>>N;
	ll ans=0;
	rep(i,N){
		ll n=i+1;
		if(n%2==0)continue;
		ll k=0;
		rep(j,n){
			if(n%(j+1)==0) k++;			
		}
		if(k==8)ans++;
	}
	cout<<ans<<endl;
}

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

int main(){
    string s, t;
    cin >> s >> t;

    ll ans = -1;
    vector<vector<int>> a(26);
    rep(i, s.size()){
        a[s[i] - 'a'].pb(i);
    }

    rep (i, t.size()){
        if (a[t[i] - 'a'].empty()){
            cout << ans << endl;
            return 0;
        }
    }
    ll now = a[t[0] - 'a'][0];
    int res = 0;
    rep(i, t.size() - 1){
        auto it = upper_bound(a[t[i + 1] - 'a'].begin(), a[t[i + 1] - 'a'].end(), now);
        if (it - a[t[i + 1] - 'a'].begin() == a[t[i + 1] - 'a'].size()){
            now = a[t[i + 1] - 'a'][0];
            res++;
        }else{
            now = *it;
        }
    }
    ans = (ll)res * s.size() + now + 1;
    cout << ans << endl;
}

Measured memory_bytes: 4228
def main():
    x, k, d = map(int, input().split())
    x = abs(x)
    if abs(x) >= k * d:
        print(abs(x - k * d))
        exit()
    c = x // d
    if abs(x - c * d) < abs(x - (c + 1) * d):
        k -= c
        k %= 2
        print(abs(x - c * d)) if k == 0 else print(abs(x - (c + 1) * d))
    elif abs(x - c * d) > abs(x - (c + 1) * d):
        k -= c + 1
        k %= 2
        print(abs(x - c * d)) if k == 1 else print(abs(x - (c + 1) * d))
    else:
        print(abs(x - c * d))





if __name__ == '__main__':
    main()


Measured memory_bytes: 9220
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    S = SS()

    stk = []
    ans = []

    for i in S:
        if i == '(':
            stk.append(i)
            ans.append(i)
        else:
            if stk and stk[-1] == '(':
                stk.pop()
                ans.append(i)
            else:
                ans.insert(0, '(')
                ans.append(i)
    
    while stk:
        ans.append(')')
        stk.pop()

    print(''.join(ans))

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9752
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        int h = sc.nextInt();
        int w = sc.nextInt();


        System.out.println(H*W -(H * w + W * h -(h*w)));
        sc.close();
    }

}


Measured memory_bytes: 21844
//Name: Osaki
//Level: 2
//Category: 区間,区間の重なり,累積和
//Note: 

/**
 * 少し問題文がわかりづらいが、与えられた区間が最も多く重なっているとき、いくつの区間が重なっているかを答える問題。
 * 1日の1秒を1要素に対応させた配列を用意して、各区間について出発時に+1、到着時に-1を書き込み、累積和を取った時に
 * 配列内の最大値が求める答えである。
 *
 * オーダーは O(N + S)。
 * ただしSは1日の秒数で、S=86400。
 */
#include <iostream>
#include <algorithm>
#include <array>

using namespace std;

int read_time() {
    int h, m, s;
    cin >> h;
    cin.ignore();
    cin >> m;
    cin.ignore();
    cin >> s;
    return h*3600 + m*60 + s;
}

bool solve(bool first) {
    int N;
    if(!(cin >> N)) return false;
    if(!N) return false;

    static array<int,86400> v;
    fill(begin(v), end(v), 0);
    for(int i = 0; i < N; ++i) {
        const int s = read_time();
        const int t = read_time();
        v[s]++;
        v[t]--;
    }
    int ans = 0;
    for(int i = 1; i < 86400; ++i) {
        v[i] += v[i-1];
        ans = max(ans, v[i]);
    }
    cout << ans << endl;
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.setf(ios::fixed);
    cout.precision(10);

    bool first = true;
    while(solve(first)) {
        first = false;
    }
    return 0;
}

Measured memory_bytes: 1532
N = int(input())
xyh = [list(map(int, input().split())) for _ in range(N)]

xyh.sort(key=lambda x: -x[2])

# print(xyh)

for x in range(101):
  for y in range(101):
    flg = True
    for i in range(N):
      if i == 0:
        ansh = xyh[i][2] + (abs(xyh[i][0] - x) + abs(xyh[i][1] - y))
      else:
        kouhoh = xyh[i][2] + (abs(xyh[i][0] - x) + abs(xyh[i][1] - y))
        if xyh[i][2] == 0:
          if ansh > kouhoh:
            flg = False
            break
        else:    
          if ansh != kouhoh:
            flg = False
            break
    if flg:
      print(x, y, ansh)
      exit()


Measured memory_bytes: 3064
# [int(j) for j in input().split()]
s = input()
n = len(s)+1
a = [[] for i in range(n)]
ch = [[] for i in range(n)]
b = [0 for i in range(n)]
for i in range(len(s)):
    if s[i]==">":
        a[i+1].append(i) 
        ch[i].append(i+1)    
    else:
        a[i].append(i+1)
        ch[i+1].append(i)
st = []
# print(a)

for i in range(n):
    if ch[i]==[]:
        st.append(i)
# print(st)
for vertex in st:
    q = [vertex]
    ct = 0
    while(q):
        curr = q.pop()
        for nb in a[curr]:
            b[nb] = max(b[nb], b[curr]+1)
            q.append(nb)
print(sum(b))


Measured memory_bytes: 157540
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}

int h,w;
vector<string>field(h);
bool seen[100][100];
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
int cnt = 0;

int dfs(int y,int x,int &cnt){
    cnt++;
    seen[y][x] = true;
    rep(i,4){
        int ny = y+dy[i],nx = x+dx[i];
        if(ny<0 || ny>=h || nx<0 || nx>=w)continue;
        if(field[ny][nx] != '#')continue;
        if(seen[ny][nx])continue;
        cnt++;
        dfs(ny,nx,cnt);
    }
    return cnt;
}

int main(){
    string s;
    ll k;cin>>s>>k;
    for(int i=0;i<k;i++){
        if(s[i] != '1'){
            cout<<s[i];
            return 0;
        }
    }
    cout<<'1';
}



Measured memory_bytes: 256
N, K = gets.split.map(&:to_i)

a = 1.0 / N
ans = (1..N).map do |n|
  if n >= K
    a
  else
    b = n
    c = 0
    while b < K
      c = c + 1
      b = b * 2
    end
    a * ((1.0 / 2) ** c)
  end
end.reduce(&:+)
puts ans


Measured memory_bytes: 2684
from sys import stdin
from itertools import repeat
def main():
    n = int(stdin.readline())
    a = map(int, stdin.readline().split(), repeat(10, n))
    mod = 1000000007
    f = [1] * (n + 1)
    for i in  xrange(2, n + 1):
        f[i] = f[i-1] * i % mod
    inv = [1] * (n + 1)
    for i in xrange(2, n + 1):
        inv[i] = mod - mod / i * inv[mod%i] % mod
    sf = [0] * (n + 1)
    for i in xrange(1, n + 1):
        sf[i] = sf[i-1] + f[n] * inv[i] % mod
        if sf[i] >= mod:
            sf[i] -= mod
    ans = 0
    for i, x in enumerate(a):
        ans += x * (sf[i+1] + sf[n-i] - f[n]) % mod
        if ans >= mod:
            ans -= mod
    print ans
main()


Measured memory_bytes: 15404
#include <stdio.h>

#define MAX 100000000

struct NODE {
    int distance;
    int state;
} vertex[101];

int W[101][101];
int V, n;

int min(int a, int b) {
    return (a > b ? b : a);
}

int prim(int start) {
    int x, p, step, sum = 0;

    for (x = 0; x < V; x++) {
	vertex[x].distance = MAX; vertex[x].state = 0;
    }
    vertex[start].distance = 0; 
    for (step = 1; step <= V; step++) {
	int minimum = MAX;
	for (x = 0; x < V; x++)
	    if (vertex[x].state == 0 && vertex[x].distance < minimum) {
		p = x; minimum = vertex[x].distance;
	    }
	vertex[p].state = 1;
	sum += minimum;
	for (x = 0 ; x < V; x++)
	    if (vertex[x].state == 0)
		vertex[x].distance = min(vertex[x].distance, W[p][x]);
    }
    return sum;
}

int main(void) {
    int i, j;
    int from, to, m;
     
    while (1) {
	scanf("%d", &V);
        if (V == 0) break;
	scanf("%d", &n);
         
        for (i = 0; i <= V; i++)
            for (j = 0; j <= V; j++)
                W[i][j] = MAX;
         
	for (i = 0; i < n; i++) {
            scanf("%d,%d,%d", &from, &to, &m);
            W[from][to] = (m / 100) - 1;
	    W[to][from] = (m / 100) - 1;
        }


	printf("%d\n", prim(0));
    }
    return 0;
}

Measured memory_bytes: 640
//-----by LY02------------------------------------
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define M 1000000007
//------------------------------------------------

int st[110];
int dp[100010];

//------------------------------------------------
int main() {
//------------------------------------------------
//	freopen("In.txt","r",stdin);
//	freopen("Out.txt","w",stdout);
//------------------------------------------------
	ios::sync_with_stdio(0);
	cin.tie(0);
//------------------------------------------------

int n,k; cin>>n>>k;
for(int i=0;i<n;i++) cin>>st[i];

for(int i=0;i<=k;i++)
{
	for(int j=0;j<n;j++)
	{
		if(i+st[j]>k) continue;
		if(dp[i]==0)
			dp[i+st[j]]=1;
	}
}

if(dp[k])
	cout<<"First\n";
else
	cout<<"Second\n";
//------------------------------------------------
	return 0;
}





//-----by LY02------------------------------------


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>>graph(N, vector<int>(N));

    for (int i=0; i<M; i++){
        int ai, bi;
        cin >> ai >> bi;
        ai--;
        bi--;
        graph[ai][bi]++;
        graph[bi][ai]++;
    }

    for (int i=0; i<N; i++){
        int ci =0;
        for (int j=0; j<N; j++){
            if (graph[i][j])ci+= graph[i][j];
        }
        cout << ci << endl;  
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define int long long
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define f first
#define s second
pair<int,int> c[114514];
int a[114514],b[114514];
string s[114514],t[114514];
signed main(){
	ic(n) ic(m)
	int ma=max(n,m);
	int mi=min(n,m);
	rep(0,i,ma){
		cout<<mi;
	}	
}	

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

int main(){
    string S,T;
    cin >> S >> T;
    int count = 0;
    for(int i = 0; i < 3; i++){
        if (S.at(i) == T.at(i)){
            count++;
        }
    }
    cout << count << endl;
}

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

int main() {
    ll n,x;
    std::cin >> n>>x;
    if(x == 1 || x == 2*n-1){
        std::cout << "No" << std::endl;
        return 0;
    }
    std::cout << "Yes" << std::endl;
    if(x == n){
        for (int i = 1; i <= 2*n-1; i++) {
            std::cout << i << std::endl;
        }
        return 0;
    }else if(x<n){
        for (int i = x+1; i <= n; i++) {
            std::cout << i << std::endl;
        }
        for (int i = 1; i <= x; i++) {
            std::cout << i << std::endl;
        }
        for (int i = n+1; i <= 2*n-1; i++) {
            std::cout << i << std::endl;
        }
    }else{
        for (int i = 1; i <= n-1; i++) {
            std::cout << i << std::endl;
        }
        for (int i = x; i <= 2*n-1; i++) {
            std::cout << i << std::endl;
        }
        for (int i = n; i <= x-1; i++) {
            std::cout << i << std::endl;
        }
    }
}
 

Measured memory_bytes: 1536
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
static immutable MOD=10^^9+7;alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std;
// dfmt on

void main()
{
    long N = lread();
    writeln((N + 1) / 2);
}


Measured memory_bytes: 3644
import sys

n = int(sys.stdin.readline().rstrip())

def main():
    bit6 = [0] * 8
    bit9 = [0] * 7
    b = n
    for i in range(5, -1, -1):
        q, r = divmod(b, 9 ** i)
        bit9[i] = q
        b = r

    res = sum(bit6) + sum(bit9)

    for _ in range(n):
        i = 0
        while True:
            bit6[i] += 1
            if bit6[i] == 6:
                bit6[i] = 0
                i += 1
            else:
                break

        i = 0
        while True:
            bit9[i] -= 1
            if bit9[i] == -1:
                bit9[i] = 8
                i += 1
            else:
                break        

        res = min(res, sum(bit6) + sum(bit9))

    return res

if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a) for(ll i=0;i<a;i++)
#define jkl ll debug = 0;
#define RREP(i,a) for(ll i=a-1;i>=0;i--)
#define rrep(i,a,b) for(ll i=a-1;i>=b;i--)
#define printall(n,array) {for(ll i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
#define mp make_pair
typedef long long ll;
typedef pair<ll, ll> Pi;
typedef pair<ll, Pi> V;
typedef vector<ll> VE;
const ll mod = 1e9 + 7; //10^9+7

ll n;

ll solve(ll x, bool a, bool b, bool c){
    if (x > n)return 0;
    ll ret = 0;
    if(a && b && c)ret++;
    ret += solve(x * 10 + 7, true, b, c);
    ret += solve(x * 10 + 5, a, true, c);
    ret += solve(x * 10 + 3, a, b, true);
    return ret;
}


int main(){
    cin >> n;
    print(solve(0, false, false, false));
    return 0;
}

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

int main(){
  char c;
  cin >> c;

  switch(c){
    case 'A':
      cout << 'T' << endl;
      break;
    case 'T':
      cout << 'A' << endl;
      break;
    case 'C':
      cout << 'G' << endl;
      break;
    case 'G':
      cout << 'C' << endl;
      break;
  }
  return 0;
}

Measured memory_bytes: 256
T=!!0
F=!T
[T,F].map{|c|
class<<c
alias:%:==
def!=x
!self|x
end
end
}
until(s=gets.tr"-=>*+","!%=&|")=~/#/
v=s.scan(/[a-z]/).uniq
puts %w(T F).repeated_permutation(v.size).all?{|a|
eval s.tr v*'',a*''
}?'YES':'NO'
end

Measured memory_bytes: 11516
#include<bits/stdc++.h>
using namespace std;
int main(){
  int q,n=0;
  int num,ten,k=0;
  int count,mx=0;
  int ans=0;
  bool check;
  int s[10000]={0};
  cin>>q;
  for(int i=0;i<q;i++){
    cin>>num;
    k=0;
    n=num;
    ans=0;
    for(int j=0;j<10000;j++){
      s[j]=0;
    }
    while(1){
      mx=0;
      check=false;
      count=2;
      if(n/10==0){
	cout<<ans<<endl;
	break;
      }
      if(n/100==0) count=3;
      else if(n/1000==0) count=4;
      else if(n/10000==0) count=5;
      else if(n/100000==0) count=6;
      else if(n/1000000==0) count=7;
      ten=1;
      for(int j=1;j<count;j++){
	ten*=10;
	mx=max(mx,(n/ten)*(n-(n/ten)*ten));
	/*out<<ten<<endl;*/
      }
      s[k]=mx;
      /*cout<<s[k]<<endl;*/
      k++;
      for(int j=0;j<k-1;j++){
	if(s[k-1]==s[j]){
	  check=true;
          break;
	}
      }
      if(check){
	cout<<-1<<endl;
	break;
      }
      n=mx;
      ans++;
    }
  }
  return 0;
}



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

int main () {
    int s, a[1000100];
    cin >> s;

    a[s]++;
    int cnt = 1;

    while(1) {
        cnt++;

        if (s % 2 == 0) { s /= 2; }
        else { s = 3*s + 1; }

        if (a[s] != 1) { a[s]++; }
        else { cout << cnt << endl; return 0; }
    }
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
l = []
for i in range(n):
    l.append([a[i],i+1])
l.sort(key=lambda x:x[0])
ans = []
for i in range(n):
    ans.append(l[i][1])
for x in ans:
    print(x,end=" ")

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

using namespace std;

int main()
{
	int N, K;
	cin >> N >> K;
	vector<int> A(N);
	for (auto& x : A) {
		cin >> x;
	}

	for (int n = 1; n <= K; ++n) {
		vector<int> B(N + 1, 0);
		for (int i = 0; i < N; ++i) {
			int l = max(0, i - A[i]);
			int r = min(N, i + A[i] + 1);
			B[l] += 1;
			B[r] -= 1;
		}
		A[0] = B[0];
		for (int i = 1; i < N; ++i) {
			A[i] = A[i - 1] + B[i];
		}
		if (count(A.begin(), A.end(), N) == N) {
			break;
		}
	}
	for (int i = 0; i < N; ++i) {
		cout << A[i] << " ";
	}
	cout << endl;
}


Measured memory_bytes: 4844