akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) ((x).begin()), ((x).end())

#define READ(x) (cin >> (x))
#define WRITE_N(x) (cout << (x) << endl)
#define WRITE(x) (cout << (x))
#define WRITE_YESNO(x) (WRITE_N((x) ? "Yes" : "No"))

#define PRECISE_COUT std::cout << std::setprecision(15) << std::fixed

bool xor_logic(bool x, bool y) { return (x && y) || (!x && !y); }

int main() {
  // get values from input
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N;
  cin >> N;

  std::vector<int> a(N, 0);
  for (size_t i = 0; i < N; i++) {
    cin >> a[i];
  }

  // main procedure
  int ans = 0;
  for (size_t i = 0; i < N; i++) {
    if ((i + 1) % 2 == 1 && a[i] % 2 == 1) {
      ans++;
    }
  }

  // output
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    rep(i,3){
        string s;
        cin >> s;
        char ans = toupper(s[0]);
        cout << ans;
    } 
    cout << endl;
    return 0;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll a, b, x; cin >> a >> b >> x;
    x -= a;
    if(x > b || x < 0) NO();
    else YES();
}

Measured memory_bytes: 256
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        a: i64,
        b: i64,
        c: i64,
        d: i64,
    };

    let a_c = a * c;
    let a_d = a * d;
    let b_c = b * c;
    let b_d = b * d;

    let mut ans = a_c;
    ans = ans.max(a_d);
    ans = ans.max(b_c);
    ans = ans.max(b_d);

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


Measured memory_bytes: 2200
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;

int main(){
  int N;
  long H,W;
  cin>>N>>H>>W;
  long a[N],b[N];
  for (int i=0;i<N;i++){
    cin>>a[i]>>b[i];
  }
  int counter=0;
  for (int i=0;i<N;i++){
    if (a[i]>=H&&b[i]>=W){
      counter+=1;
    }
  }
  cout<<counter;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);



int main(){fastio
    double pi=3.14159265358979;
    double a,b,h,m;cin>>a>>b>>h>>m;
    double aa=((h*60+m)*2*pi)/(double)(12*60);
    double bb=((h*60+m)*2*pi)/(double)(60);
    double c=bb-aa;
    double ans=sqrt(a*a+b*b-2*a*b*cos(c));
    cout<<setprecision(20)<<ans<<endl;
    
    return 0;
}



Measured memory_bytes: 4232
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <stack>
#include <map>
#include <queue>
#include <functional>
using namespace std;
typedef long long ll;
int main(){
	int h,w;
	cin >> h >> w;

	map<char,int> mp;
	for(int i = 0;i < h * w;i++){
		char c;
		cin >> c;
		mp[c]++;
	}

	int cnt1 = 0;
	int cnt2 = 0;
	for(auto p:mp){
		int now = p.second % 4;
		if(now == 3){
			cnt1++;
			cnt2++;
		}
		else if(now == 2){
			cnt2++;
		}
		else if(now == 1){
			cnt1++;
		}
	}

	if(h % 2 == 0 && w % 2 == 0){
		if(cnt1 == 0 && cnt2 == 0){
			cout << "Yes" << endl;
			return 0;
		}
	}
	else if(h % 2 == 0){
		if(cnt2 * 2 <= h && (h - cnt2 * 2) % 4 == 0 && cnt1 == 0){
			cout << "Yes" << endl;	
			return 0;
		}
	}
	else if(w % 2 == 0){
		if(cnt2 * 2 <= w && (w - cnt2 * 2) % 4 == 0 && cnt1 == 0){
			cout << "Yes" << endl; 
			return 0;
		}
	}
	else{
		if(cnt1 == 1 && cnt2 * 2 <= h + w - 2 && (h + w - 2 - cnt2 * 2) % 4 == 0){
			cout << "Yes" << endl;
			return 0;
		}
	}
	
	cout << "No" << endl;
}


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

using namespace std;

int n,m;
int hon[101];
int nibun(){
	int R,L;R=L=0;
	for(int i=0;i<m;i++){
		L+=hon[i];
	}
	while(1){
		if(R==L){
			return R;
		}
		double H=(double)(R+L)/2;
		
		int dan=0;
		int at=0;
		for(int i=0;i<m;i++){
			if(hon[i]>H){
				dan=10000;
				break;
			}
			if(at+hon[i] <= H){
				at+=hon[i];
			}else{
				at=0;
				dan++;
				at+=hon[i];
			}
		}
		
		if(dan<n){
			L=H;
		}else{
			R=H+0.5;
		}
		
	}
}
int main(){
	int cont=0;
	while(1){
		scanf("%d%d",&n,&m);
		if(n==0&&m==0){
			break;
		}
		for(int i=0;i<m;i++){
			scanf("%d",&hon[i]);
		}
		printf("%d\n",nibun());
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >=0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
 
typedef long long ll;
#define INF 1e9


int main(){
  ll N, M;
  cin >> N >> M;
  if(N >= 3 && M >= 3){
    cout << (N-2)*(M-2) << endl;
  }
  else if(N==2 || M==2){
    cout << 0 << endl;
  }
  else if(N > M){
    cout << (N-2) * M << endl;
  }
  else if(M > N){
    cout << (M-2)*N << endl;
  }
  else{
    cout << 1 << endl;
  }
  // else{
  //   cout << (ll)max(1, N-2) * (ll)max(1, M-2) << endl;
  // }



  return 0;
}

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

int main() {
  int x,y,z,q;
  cin >> x >> y >> z >> q;
  vector<long long> a(x),b(y),c(z);
  rep (i,x) cin >> a.at(i);
  rep (i,y) cin >> b.at(i);
  rep (i,z) cin >> c.at(i);
  sort (a.begin(),a.end());
  reverse(a.begin(),a.end());
  sort (b.begin(),b.end());
  reverse(b.begin(),b.end());
  sort (c.begin(),c.end());
  reverse(c.begin(),c.end());
  vector<long long> u(0);
  rep(i,x){
      rep(j,y){
          rep(k,z){
              if (i*j*k>3000) break;
              u.push_back(a.at(i)+b.at(j)+c.at(k));
          }
      }
  }
  sort (u.begin(),u.end());
  reverse(u.begin(),u.end());
  rep(i,q){
      cout << u.at(i) << endl;
  }
}

Measured memory_bytes: 35176
#include<bits/stdc++.h>
#include<vector>
#include<set>
#include<algorithm>

using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
#define T int t, q=0; scanf("%d", &t); while(q++<t)
#define ll long long
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
ll x,y,z,a=0,b=0,c=0,d=0,sum,ans,total,cnt,n,m,k,p,kase,i,t;
string s1,s2;
#define N 100001
#define MX 1000000001
vector <ll> v;
map<ll,ll> mp;
set<ll> s;
map<ll,ll> :: iterator itr1, ptr1;
set<ll> :: iterator itr, ptr;


int main()
{

 int n; cin >> n;
    vector<int> l(n);
    for (int i = 0; i < n; i++) cin >> l[i];

       sort(l.begin(), l.end());
    int res = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            for (int k = j + 1; k < n; k++) {
                int x = l[i], y = l[j], z = l[k];
                if (z < x + y && x != y && y != z) {
                    // trace(x, y, z);
                    res++;
                }
            }
        }
    }
    cout << res << '\n';
    return 0;
}



// Happy Coding  (:





Measured memory_bytes: 3576
#include<bits/stdc++.h>
#define fasterthanlight ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define test int T; cin>>T; while(T--)
#define endl "\n"
#define int long long
#define vi vector<int>
#define pb push_back
#define mod 1000000007
#define MAX 1e9
#define MIN -1e9
#define hi "visited\n" //sasta debugging
using namespace std;

//author::@whohet-->Het Patel

signed main()
{
    fasterthanlight;
    int sum = 0; int ans;
    for (int i = 0; i < 5; i++)
    {
        cin >> sum;
        if (sum == 0)
        {
            ans = i + 1;
        }
    }
    cout << ans;

    //cout << "\n\n"<<"Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " seconds.\n";
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define NMAX 300005

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

int main()
{
    string a,b;
    cin>>a>>b;
    ll ans=INT_MAX;
    for(ll i=0;i<=a.size()-b.size();i++){
        ll cnt=0;
        for(ll j=0;j<b.size();j++)
            cnt+=(a[i+j]!=b[j]);
        ans=min(ans,cnt);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3624
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
#define l(i,a,b) for(auto i=a;i<b;i++)
#define lr(i,a,b) for(auto i=a;i>=b;i--)
#define ll long long
#define lli long long int
#define ld long double
#define vec vector<int>
#define mii map<ll,ll>
#define vl vector<long long>
#define se set <long long int>
#define pi pair<long long,long long>
#define pb push_back
#define mp make_pair
#define ft first
#define sd second
#define all(v) v.begin(), v.end()
#define in(x) cin>>x
#define o(x) cout<<x
#define SYNC ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.14159265359
using namespace std;
 
ll modulo(ll a, ll b, ll n){
    long long x=1, y=a; 
    while (b > 0) {
        if (b%2 == 1) {
            x = (x*y) % n; 
        }
        y = (y*y) % n;
        b /= 2;
    }
    return x % n;
}
const int N = 1e5 + 7;

ll dp[N];
vector<vector<ll>>tree(N);
ll n, m;

void dfs(ll i)
{
    dp[i]=1;
    for(ll j=0; j<tree[i].size(); j++)
    {
        if(!dp[tree[i][j]])
        dfs(tree[i][j]);
        dp[i]=max(dp[i],dp[tree[i][j]] + 1);
    }
}

int main()
{
    SYNC
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    in(n)>>m;
    l(i,0,m)
    {
        ll x,y;
        in(x)>>y;
        tree[x].pb(y);
    }
    l(i,0,n)
    {
        if(!dp[i+1])
        dfs(i+1);
    }
    ll ans=0;
    l(i,1,n+1)
    {
        ans=max(ans,dp[i]);
    }
    o(ans-1)<<endl;
    

    
 
    
 
}


Measured memory_bytes: 11548
while True:
	try:
		y, m, d = map(int, raw_input().split())
		date = int("{}{}{}".format('%04d'%y,'%02d'%m,'%02d'%d))
		if date < 18680908:
			print "pre-meiji"
		elif date < 19120730:
			y = y - 1868 + 1
			print "meiji {} {} {}".format(y,m,d)
		elif date < 19261225:
			y = y - 1912 + 1
			print "taisho {} {} {}".format(y,m,d)
		elif date < 19890108:
			y = y - 1926 + 1
			print "showa {} {} {}".format(y,m,d)
		else:
			y = y - 1989 + 1
			print "heisei {} {} {}".format(y,m,d)
	except:
		break

Measured memory_bytes: 4224
$a=<>;
$b=<>;
$c=<>;
$x=<>/50;
$ans=0;
for ($i=0;$i<=$a;$i++){
    for ($j=0;$j<=$b;$j++){
        for ($k=0;$k<=$c;$k++){
            $ans++ if 10*$i+2*$j+$k == $x;
        }
    }
}
print $ans;

Measured memory_bytes: 4592
#include <bits/stdc++.h>
using namespace std;
#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
using ll = long long;

int main() {
    int N;
    cin >> N;
    vector<int> point(N);
    rep(i, 0, N){
         cin >> point[i];
         point[i]--;
    }
    int now = 0, cnt = 0;
    rep(i, 0, N){
        cnt++;
        now = point[now];
        if(now == 1){
            cout << cnt << endl;
            return 0;
        }
    }
    cout << "-1" << endl;
}

Measured memory_bytes: 640
using System;
using System.Linq;

namespace _2331
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] x = new int[100010];
            for (int i = 0; i < n; i++)
            {
                int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray(); a[0]--; a[1]--;
                x[a[0]]++; x[a[1] + 1]--;
            }
            int ret = 0; int sum = 0;
            for (int i = 1; i <= n; i++)
            {
                sum += x[i];
                if (sum >= i) ret = Math.Max(ret,i);
            }
            Console.WriteLine(ret);
        }
    }
}


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

int main()
{

   int n,arr[2002];
   scanf("%d",&n);
   for(int i=1;i<=n;i++)
   {
       scanf("%d",&arr[i]);
   }
   sort(arr,arr+(n+1));
   int a,b,c,li=0,temp=1;
   for(int i=1;i<=n-2;i++)
   {
       a=arr[i];

       for(int j=i+1;j<=n-1;j++)
       {
           b=arr[j];
           for(int k=j+1;k<=n;k++)
           {
               c=arr[k];

               if((a<(b+c))&&(b<(c+a))&&(c<(a+b)))
               {
                   li++;
               }
               else
               {
                   break;
               }
           }
       }
   }
   printf("%d\n",li);

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define I_L_T_S ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); 
const int N = 1e5 + 2;
const int mod = 1e9 + 7;

long long binpow(long long a, long long b) {
    a %= mod;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}
int32_t main(){
   I_L_T_S;
   int n;
   cin >> n ;
   string s[n];
   map <string , int> mp;
   for(int i = 0 ; i < n ; i++){
        cin >> s[i];
        sort(s[i].begin() ,s[i].end());
        mp[s[i]]++;
   }
   int ans = 0;
   for(auto x : mp){
        int k = x.second;
        ans+=(k*(k - 1))/2;
   }
   cout << ans << " "; 
   
  return 0;
}


Measured memory_bytes: 16640
#!/usr/bin/env python3
import sys
import math
MOD = 1000000007  # type: int


def factorization(n: int):
    if n == 1:
        return []
    factors = None
    for i in range(2, math.ceil(math.sqrt(n))+1):
        if n % i == 0:
            factors = [i] + factorization(n // i)
            break
    if factors == None:
        return [n]
    else:
        return factors


def comb(i: int, j: int):
    if j > i-j:
        return comb(i, i-j)
    mul = 1
    for k in range(i-j+1, i+1):
        mul *= k
    for k in range(2, j+1):
        mul //= k
    #print(f"{i}C{j} = {mul}")
    return mul


def solve(N: int, M: int):
    factor = factorization(M)
    factorDict = {}
    for f in factor:
        if f not in factorDict:
            factorDict[f] = 0
        factorDict[f] += 1
    mul = 1
    for k in factorDict:
        mul = (mul*comb(factorDict[k]+N-1, factorDict[k])) % MOD
    print(mul)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    solve(N, M)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
from math import sqrt
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

N, M, K = getNM()
A = [0] + getList()
B = [0] + getList()

total = K
b_left = sum(B)
l = M

ans = 0
# Aがright番目まで進んだ時
for r in range(N + 1):
    total -= A[r]
    # Aの本を取りすぎる場合は飛ばす
    if total < 0:
        continue
    # 合計total以下になるまで戻る
    while total < b_left:
        b_left -= B[l]
        l -= 1
    ans = max(ans, l + r)
print(ans)

Measured memory_bytes: 123296
#include <iostream>

using namespace std;

long long int f(int n)
{
    if (n == 1) return 1;
    if (n == 2) return 2;
    
    return n*f(n-1);
}

int main()
{ 
    int n;
    
    cin >> n;
    
    cout << f(n) << endl;

    return 0;    
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include <ext/rope>

#pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops, no-stack-protector")
#pragma GCC target("avx,avx2,fma")

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define gcd __gcd
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define rep(i, n) for (int i=0; i<(n); i++)
#define rep1(i, n) for (int i=1; i<=(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl "\n"

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned uint;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
template<typename _def> using ordered_set=tree<_def, null_type, less<_def>, rb_tree_tag, tree_order_statistics_node_update>;
typedef trie<string, null_type, trie_string_access_traits<>, pat_trie_tag, trie_prefix_search_node_update> pref_trie;

bitset<4000001> dp;

int32_t main() {
    fastio;
    dp[0]=1;
    int n, s=0; cin>>n;
    rep(i, n) {
        int x; cin>>x; s+=x;
        dp|=dp<<x;
    }
    for(int i=s/2; i>=0; i--) if(dp[i]) return cout<<s-i<<endl, 0;
}


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

int main() {
  int N;
  long double P=0;
  cin >> N;
  vector<double>K(N);
  vector<string>H(N);
  for(int i = 0;i < N;i++){
    cin >> K[i];
    cin >> H[i];
  }
  for(int i = 0;i < N;i++){
    if(H[i] == "JPY") P += K[i];
    else P += (380000 * K[i]);
  }
  cout << P <<endl;
}

Measured memory_bytes: 3720
N=int(input())
L=[]
for i in range(N):
    a,b=map(int, input().split())
    L.append((a,b,a+b))

L=sorted(L, reverse=True, key=lambda x: x[2])
taka=0
ao=0
for i in range(N):
    l=L[i]
    a,b,_=l
    if i%2==0:
        taka+=a
    else:
        ao+=b
print(taka-ao)

Measured memory_bytes: 22940
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] arr = new int[5];
        for (int i = 0; i < 5; i++) {
            arr[i] = in.nextInt();
            if (arr[i] != i + 1) {
                System.out.println(i + 1);
                return;
            }
        }
    }
}


Measured memory_bytes: 35752
board = [[0]*10 for _ in range(10)]
while True:
    try:
        x, y, size = map(int, input().split(','))
    except:
        break
    small = [(-1, 0), (0, -1), (0, 0), (0, 1), (1, 0)]
    med = [(-1, -1), (-1, 0), (-1, 1),
           (0, -1), (0, 0), (0, 1),
           (1, -1), (1, 0), (1, 1)]
    large = [(-2, 0),
             (-1, -1), (-1, 0), (-1, 1),
             (0, -2), (0, -1), (0, 0), (0, 1), (0, 2),
             (1, -1), (1, 0), (1, 1),
             (2, 0)]
    dyx = [small, med, large][size-1]
    for dy, dx in dyx:
        ny, nx = y + dy, x + dx
        if 0 <= nx < 10 and 0 <= ny < 10:
            board[ny][nx] += 1

print(sum(sum(1 for i in range(10) if row[i] == 0) for row in board))
print(max([max(row) for row in board]))

Measured memory_bytes: 6772
#include <iostream>
#include <vector>
#include <unordered_set>
#include <cstring>

using namespace std;

const int INF = 1e9 + 5;

using ll = long long;

void min_self(ll& a, ll b) {
    a = min(a, b);
}

int main() {
    ll n, W;
    scanf("%lld%lld", &n, &W);

    ll maxVal = 0;

    vector<ll> w(n), v(n);

    // dp[i] - the minimum weight required to achieve i value
    for(int item = 0; item < n; ++item) {
        ll weight, value;
        scanf("%lld%lld", &weight, &value);
        w[item] = weight;
        v[item] = value;
        maxVal += value;

    }

    vector<ll> dp(maxVal+1, INF); // 0 ... maxVal
    dp[0] = 0;

    for (ll i = 0; i < n; ++i) {
        for(ll value_already = maxVal - v[i]; value_already >= 0; --value_already) {
            min_self(dp[value_already + v[i]], dp[value_already] + w[i]);
        }
    }
//    for (int i = 0; i <= maxVal; ++i) {
//        cout << "dp[" << i << "] =" << dp[i] << endl;
//    }

//    cout << endl;


    ll answer = 0;
    for(ll i = 0; i <= maxVal; i++) {

//        cout << "comparing dp[" << i << "] = " <<  dp[i] << " and " << W << endl;
        if (dp[i] <= W) {
            answer = i;
        }
//        cout << "i = " << i << ", answer = " << answer << endl;
    }
    printf("%lld\n", answer);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define sar(a,n) {cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl;}

using namespace std;

template<typename S,typename T>auto&operator<<(ostream&o,pair<S,T>p){return o<<"{"<<p.fi<<","<<p.se<<"}";}
template<typename T>auto&operator<<(ostream&o,set<T>s){for(auto&e:s)o<<e<<" ";return o;}
template<typename S,typename T,typename U>
auto&operator<<(ostream&o,priority_queue<S,T,U>q){while(!q.empty())o<<q.top()<<" ",q.pop();return o;}
template<typename K,typename T>auto&operator<<(ostream&o,map<K,T>&m){for(auto&e:m)o<<e<<" ";return o;}
template<typename T>auto&operator<<(ostream&o,vector<T>v){for(auto&e:v)o<<e<<" ";return o;}
void ashow(){cout<<endl;}template<typename T,typename...A>void ashow(T t,A...a){cout<<t<<" ";ashow(a...);}
template<typename S,typename T,typename U>
struct TRI{S fi;T se;U th;TRI(){}TRI(S f,T s,U t):fi(f),se(s),th(t){}
bool operator<(const TRI&_)const{return(fi==_.fi)?((se==_.se)?(th<_.th):(se<_.se)):(fi<_.fi);}};
template<typename S,typename T,typename U>
auto&operator<<(ostream&o,TRI<S,T,U>&t){return o<<"{"<<t.fi<<","<<t.se<<","<<t.th<<"}";}

typedef pair<int, int> P;
typedef pair<ll, ll> pll;
typedef TRI<int, int, int> tri;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef vector<string> vs;

const int MAX_N = 100005;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ull n, X;
    cin >> n >> X;
    vector<ull> x(n), sm(n+1);
    sm[0] = 0;
    rep(i,n){
        cin >> x[i];
    }
    reverse(all(x));
    rep(i,n){
        sm[i+1] = sm[i] + x[i];
    }
    ull ans = numeric_limits<ull>::max();
    srep(i,1,n+1){
        ull res = 0;
        ull cur = 0, nw = 0;
        while(true){
            if(nw == 0) res += 2 * (sm[cur + i] - sm[cur]);
            res += (2 * nw + 3) * (sm[min(cur + i, n)] - sm[cur]);
            if((cur += i) >= n) break;
            ++nw;
        }
        cmn(ans, res + X * (n + i));
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3328
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

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

void solve() {
  int n, k;
  cin >> n >> k;
  vector<int> v;
  v.resize(n);
  for(int i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  int ret = 1e9;
  k--;
  for(int i = k; i < n; i++) {
    ret = min(ret, v[i] - v[i-k]);
  }
  cout << ret << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
  solve();
}


Measured memory_bytes: 640
#include <stdio.h>
int main(int argc, char *argv[])
{
	int i,n,k,a,sum=0;
    while(scanf("%d%d",&n,&k)!=EOF)
    {
    	sum=0;
      for(i=1;i<=n;i++)
      {
      	scanf("%d",&a);
      	if(k-a<a)sum+=2*(k-a);
      	else sum+=2*a;
      }  
	  printf("%d\n",sum);  
    }
	return 0;
}

Measured memory_bytes: 128
N, M, K = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)
B = gets.split.map(&:to_i)
C = [0]
D = [0]

A.each do |a|
  C << C.last + a
end

C << Float::INFINITY

B.each do |b|
  D << D.last + b
end

D << Float::INFINITY

ans = 0

C.each_with_index do |c, cnt_a|
  r = K - c
  next if r < 0

  cnt_b = D.bsearch_index { |d| r < d }

  if r < D[cnt_b]
    cnt_b -= 1
  end

  cnt = cnt_a + cnt_b

  ans = cnt if ans < cnt
end

puts ans


Measured memory_bytes: 45012
#include <stdio.h>

//[i][0]:©©, [i][1]:A±ÅÀñÅéÂ
int size,t[100001][2];

int main(void){
	int i,j;
	int n,x,ans;

	while(scanf("%d",&n) && n){
		scanf("%d",&x);
		t[0][0] = x;
		t[0][1] = size = 1;

		for(i=0;i<n-1;i++){
			scanf("%d",&x);
			if(i % 2 == 0){ //ô
				if(t[size-1][0] == x){
					t[size-1][1]++;
				}
				else{
					if(size >= 2){
						t[size-2][1] += t[size-1][1] + 1;
						size--;
					}
					else{
						t[size-1][0] = x;
						t[size-1][1]++;
					}
				}
			}
			else{ //ï
				if(t[size-1][0] == x){
					t[size-1][1]++;
				}
				else{
					t[size][0] = x;
					t[size++][1] = 1;
				}
			}
		}

		ans = 0;
		for(i=0;i<size;i++){
			ans += t[i][0] == 0 ? t[i][1] : 0;
		}
		printf("%d\n",ans);
	}

	return 0;
}

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

int main() {
  long long N, X, T;
  cin >> N >> X >> T;
  
  int sum = 0;
  int time = 0;
  while (sum < N) {
    sum += X;
    time += T;
  }
  cout << time << endl;
  
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
using namespace std;
 
int main() {
    string s;
    cin >> s;
    int n = s.length();
 
    for(int i = 0; i < n; i++) {
        if(s[i] != s[n - 1 - i]) {
            cout << "No" << endl;
            return 0;
        }
    }
 
    for(int i = 0; i < (n - 1) / 2; i++) {
        if(s[i] != s[(n-1)/2 - 1 - i]) {
            cout << "No" << endl;
            return 0;
        }
        if(s[i + (n+1)/2] != s[n - 1 - i]) {
            cout << "No" << endl;
            return 0;
        }
    }
 
    cout << "Yes" << endl;
    
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
N = int(input())
count = 0


def dfs(s):
    if int(s) > N: #終了条件
        return 
    
    list = []
    for c in '753': #753数か判定
        if s.count(c) > 0:
            list.append(True)
        else:
            list.append(False)
    if all(list):
        global count 
        count += 1;
    
        
    for c in '753':
        dfs(s + c)
    
    return

dfs('0')
print (count)

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
typedef long long ll;

int gcd(int n, int m){
    if(n % m == 0) return m;
    return gcd(m, n % m);
}

int main()
{
    int k;
    cin >> k;
    ll ans = 0;
    for(int i = 1; i <= k; i++){
        for(int j = 1; j <= k; j++){
            for(int l = 1; l <= k; l++) ans += gcd(gcd(i, j), l);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){
  if(b==0){
    return a;
  }
  return gcd(b,a%b);
}
int main(){
  ll n,m;
  string s,t;
  cin >> n >> m >> s >> t;
  ll g=gcd(n,m);
  ll l=n/g*m;
  ll u=n/g,v=m/g;
  bool flag=true;
  for(int i=0;i<g;i++){
    if(s[i*u]!=t[i*v]){
      flag=false;
    }
  }
  if(flag){
    cout << l << endl;
  }
  else{
    cout << -1 << endl;
  }
}

Measured memory_bytes: 512
#include <fstream>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <queue>
#include <random>

using namespace std;

#define min(a,b) ((a)<(b) ? (a):(b))
#define max(a,b) ((a)>(b) ? (a):(b))

int gcd(int a, int b){
    while( b ){
        int m = a % b;
        a = b;
        b = m;
    }
    return a;
}

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

int isPrim(int a){
    if(a==1){
        return 0;
    }
    for(int i=2;i<=(a+1)/2;i++){
        if(a%i==0){
            return 0;
        }
    }
    return 1;
}

long long mod_pow(long long x, long long n, long long mod){
    //xのn乗を計算するのにn乗を2進表記にして計算
    //x^22 = x^16 + x^4 + x^2
    long long ret=1;
    while(n>0){
        if(n%2==1){
            ret=(ret*x)%mod;//答えに付加
        }
        x=(x*x)%mod;//2乗
        n=n/2;
    }
    return ret;
}

struct VV{
    int x;
    int y;
    int z;
};

class LessInt {
public:
    bool operator()(const VV& riLeft, const VV& riRight) const {
        if(riLeft.x == riRight.x){
            return riLeft.y > riRight.y;
        }
        return riLeft.x > riRight.x;
        
    }
};

class indInt {
public:
    bool operator()(const VV& riLeft, const VV& riRight) const {
        return riLeft.x < riRight.x;
        
    }
};

struct XX{
    long long min=0;
    long long kake=0;
};

class xxIntu {
public:
    bool operator()(const XX& riLeft, const XX& riRight) const {
        //第1条件
        if(riLeft.kake != riRight.kake){
            return riLeft.kake > riRight.kake;//<:昇順(小さい順)、>:降順(大きい順)
        }
        //第2条件
        return riLeft.min > riRight.min;
    }
};
bool operator< (const VV &riLeft, const VV &riRight){
    return riLeft.z < riRight.z;
};
/*bool operator> (const XX &riLeft, const XX &riRight){
    return riLeft.a > riRight.a;
};*/



int main(int argc, const char * argv[])
{
    //std::ios::sync_with_stdio(false);
    //scanf("%s",S);
    //scanf("%d",&N);
    //getline(cin, target);
    //cin >> x >> y;
    //テスト用
    //ifstream ifs( "1_06.txt" );
    //ifs >> a;
    //ここから

    string a,b,c;
    cin >> a >> b >>c;
    string tmp=a.substr(0,1);
    a=a.substr(1,a.size()-1);
    int i=0;
    string ans="";
    while(1){
        i++;
        if(tmp=="a"){
            if(a.size()==0){
                ans="A";
                break;
            }
            tmp=a.substr(0,1);
            a=a.substr(1,a.size()-1);
        }else if(tmp=="b"){
            if(b.size()==0){
                ans="B";
                break;
            }
            tmp=b.substr(0,1);
            b=b.substr(1,b.size()-1);
        }else if(tmp=="c"){
            if(c.size()==0){
                ans="C";
                break;
            }
            tmp=c.substr(0,1);
            c=c.substr(1,c.size()-1);
        }
    }

    cout << ans << endl;
    

    
    //cout << "ans" << endl;
    
    //ここまで
    //cout << "ans" << endl;改行含む
    //printf("%.0f\n",ans);//小数点以下表示なし
    //printf("%.7f\n",p);
    //printf("%f\n",pow(2,ans.size()));
    
    return 0;
}

Measured memory_bytes: 256
/*
    Author : DemonStar
*/

// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx2,tune=native")

#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<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update>
#define fast                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
#define ll long long
#define pi pair<int, int>
#define pl pair<long long, long long>
#define pld pair<long double, long double>
#define endl '\n'
#define loop(i, n) for (ll i = 0; i < n; i++)
#define rep(i, begin, end) for (__typeof(begin) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define all(x) x.begin(), x.end()
#define vl vector<ll>
#define vi vector<int>
#define ml map<ll, ll>
#define vpl vector<pair<ll, ll>>
const ll mod = 1e9 + 7;

template <typename T, typename TT>
ostream &operator<<(ostream &os, const pair<T, TT> &t)
{
    return os << t.first << " " << t.second;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &t)
{
    for (auto &i : t)
        os << i << " ";
    return os;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &v)
{
    for (T &t : v)
        is >> t;
    return is;
}
template <typename T1, typename T2>
istream &operator>>(istream &is, vector<pair<T1, T2>> &v)
{
    for (pair<T1, T2> &t : v)
        is >> t.first >> t.second;
    return is;
}

int main()
{
    fast;
    int n, w;
    cin >> n >> w;
    vpl v(n);
    cin >> v;
    vector<vl> dp(n + 1, vl(w + 1, 0));
    dp[0][0] = 0;
    rep(i, 1, n + 1)
    {
        loop(j, w + 1)
        {
            dp[i][j] = dp[i - 1][j];
            if (j - v[i - 1].first >= 0)
                dp[i][j] = max(dp[i][j], dp[i - 1][j - v[i - 1].first] + v[i - 1].second);
        }
    }
    cout << dp[n][w] << endl;

#ifdef LOCAL
    cerr
        << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif

    return 0;
}

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

int main()
{
  char s[110];
  scanf("%s",s);
  int n=strlen(s);
  int ans=1000;
  for(int c=0;c<26;c++){
    int m=0;
    for(int i=0;i<n;){
      if(s[i]=='a'+c){
	i++;
	continue;
      }
      int t=1;
      while(i+t<n&&s[i+t]!='a'+c){
	t++;
      }
      m=max(m,t);
      i+=t;
    }
    ans=min(ans,m);
  }
  printf("%d\n",ans);
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
 
int main() {
    string S, T;
    cin >> S >> T;
 
    //答えansを仮置きする。
    //これが十分に大きくないと不正解となるので、
    //この値なら絶対に正しい答えが出る、という値を仮置きすること
    int ans = T.size();
 
    //Sの何文字目から調べるかを全探索する
    for (int start = 0; start <= S.size() - T.size(); start++)
    {
        int diff = 0;
        for (int i = 0; i < T.size(); i++)
        {
            if (T[i] != S[start + i]) {
                diff++;
            }
        }
        ans = min(ans, diff);
    }
 
    cout << ans << endl;
}

Measured memory_bytes: 3584
import Data.List
import Data.Char
import Data.Maybe
import Control.Monad
import qualified Data.ByteString.Char8 as BS8

main :: IO ()
main = do
    x <- fst . fromJust . BS8.readInteger <$> BS8.getLine

    let
        m = ceiling $ (toRational(x `mod` 100)) / 5
        n = div x 100

    print $ if n >=m
        then 1
        else 0


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

int main(){

    int N, a[1000];
    cin >> N;
    for( int i = 0; i < N; i++ ) cin >> a[i];

    int min = 1000, max = 0;

    for( int i = 0; i < N; i++ ){
        if( max < a[i] ) max = a[i];
        if( min > a[i] ) min = a[i] ;
    }

    cout << max - min << endl;

    return 0;
}

Measured memory_bytes: 256
N = int(input())
j = []
for i in range(N):
    a,b = map(int, input().split())
    j.append(a)
    j.append(b)

is_jail = False
for i in range(2*N-5):
    if j[i] == j[i+1] and j[i+2] == j[i+3] and j[i+4] == j[i+5]:
        is_jail = True

if is_jail:
    print("Yes")
else:
    print("No")


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

#define ll long long
#define pb push_back

const long long modi = 1000000007;

int main() {
    int n;
    int kinda = 0;
    cin >> n;
    long long arr[n];
    for (int i = 0; i < n; i++){
        cin >> arr[i];
        if (i != 0){
            kinda+=arr[i];
            kinda = kinda % modi;
        }
    }

    long long ans = 0;
    // for (int i = 0; i < n - 1; i++){
    //    for (int j = i + 1; j < n; j++){
    //        ans += arr[i] * arr[j];
    //        ans = ans % modi;
    //    }
    //}
    //cout << ans;
    for (int i = 0; i < n; i++){
        ans += arr[i] * kinda;
        ans = ans % modi;
        kinda -= arr[i + 1];
        if (kinda < 0){
            kinda+=modi;
        }
        kinda = kinda % modi;
    }
    cout << ans;
}


Measured memory_bytes: 5200
#include<stdio.h>
#include<math.h>
#define PI 3.14159265
int main()
{
	int a, b, C;
	double S, L, h, rad;

	scanf("%d %d %d", &a, &b, &C);

	rad = PI*C /180;

	S = 0.5 * a * b * sin(rad);

	L = a + b + sqrt(a*a + b*b - 2*a*b*cos(rad));

	h = b * sin(rad);

	printf("%f\n%f\n%f\n", S, L, h);

	return 0;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define long long long

int main(){
    IOS;

    long int n,m;
    cin>>n>>m;

    priority_queue<long int> pq;
    for(long int i = 0; i < n; i++){
        long int x;
        cin>>x;
        pq.push(x);
    }

    long int ans = 0;
    while(m--){
        long int ele = pq.top();
        pq.pop();
        pq.push(ele/2);
    }

    while(pq.size()){
        ans += pq.top();
        pq.pop();
    }

    cout<<ans;
    return 0;
}

Measured memory_bytes: 1400
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 1e+8
#define EPS 1e-8
#define rep(i,j) for(int i = 0; i < (j); i++)
#define reps(i,j,k) for(int i = (j); i < (k); i++)
typedef long long ll;
typedef pair < int , int > Pii;
int stage[100][100];
int w,h;
int res;
int dfs(int y,int x,int dep,int ans){
	ans = max(ans,dep);
	rep(i,4){
		int tx = x+dx[i],ty = y+dy[i];
		if(tx >= 0 && tx < w && ty >= 0 && ty < h && stage[ty][tx] == 1){
			stage[ty][tx] = 0;
			dfs(ty,tx,dep+1,ans);
			stage[ty][tx] = 1;
		}
		else res = max(res,ans);
	}
}
int main(){
	while(scanf("%d%d",&w,&h),w){
		res = -1000;
		rep(i,h){
			rep(j,w){
				scanf("%d",&stage[i][j]);
			}
		}
		rep(i,h){
			rep(j,w){
				if(stage[i][j] == 1){
					stage[i][j] = 0;
					dfs(i,j,1,0);
					stage[i][j] = 1;
				}
			}
		}
		printf("%d\n",res);
	}
	return 0;
}

Measured memory_bytes: 1216
package main

import (
	"fmt"
)

func relu(x int) int{
	if x < 0{
		x = 0
	}
	return x
}

func main(){
	var m, f, r, score int
	for{
		fmt.Scan(&m, &f, &r)
		if m == -1 && f == -1 && r == -1{
			break
		}
		if m == -1 || f == -1{
			fmt.Println("F")
			continue
		}
		score = relu(m) + relu(f)
		if score >= 80{
			fmt.Println("A")
		} else if score >= 65{
			fmt.Println("B")
		} else if score >= 50{
			fmt.Println("C")
		} else if score >= 30{
			if r >= 50{
				fmt.Println("C")
			} else {
				fmt.Println("D")
			}
		} else {
			fmt.Println("F")
		}

	}
}


Measured memory_bytes: 1092
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef pair <int, int> P;

class LowLink {
    const vector<vector<int>> edge;
    vector <bool> used;
    vector <int> ord; // DFS木で訪れた順
    vector <int> low; // 後退辺を1度だけ通って辿れるordの最小値

public:
    vector <int> articulation; // 関節点
    vector <P> bridge; // 橋

    LowLink(const vector<vector<int>> &edge) : edge(edge) {}

    int dfs(int cur, int k, int par) {
        used[cur] = true;
        ord[cur] = k++;
        low[cur] = ord[cur];
        bool is_articulation = false;
        int children = 0;
        for (int to : edge[cur]) {
            if (!used[to]) {
                children++;
                k = dfs(to, k, cur);
                low[cur] = min(low[cur], low[to]);
                if (par >= 0) is_articulation |= low[to] >= ord[cur];
                if (low[to] > ord[cur]) bridge.push_back({cur, to});
            } else if (to != par) {
                low[cur] = min(low[cur], ord[to]);
            }
        }
        if (par == -1) is_articulation |= children > 1;
        if (is_articulation) articulation.push_back(cur);
        return k;
    }

    void build() {
        used.assign(edge.size(), false);
        ord.assign(edge.size(), 0);
        low.assign(edge.size(), 0);
        for (int i = 0; i < edge.size(); i++) {
            if (!used[i]) dfs(i, 0, -1);
        }
    }
};


// verified
//   http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_3_A&lang=jp
void AOJ_GRL_3_A() {
    int V, E;
    cin >> V >> E;

    vector<vector<int>> edge(V);
    for (int i = 0; i < E; i++) {
        int s, t;
        cin >> s >> t;
        edge[s].push_back(t);
        edge[t].push_back(s);
    }

    LowLink lowlink(edge);
    lowlink.build();

    sort(lowlink.articulation.begin(), lowlink.articulation.end());
    for (int i : lowlink.articulation) cout << i << '\n';
}


// verified
//   http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_3_B&lang=jp
void AOJ_GRL_3_B() {
    int V, E;
    cin >> V >> E;

    vector<vector<int>> edge(V);
    for (int i = 0; i < E; i++) {
        int s, t;
        cin >> s >> t;
        edge[s].push_back(t);
        edge[t].push_back(s);
    }

    LowLink lowlink(edge);
    lowlink.build();

    vector <P> bridge = lowlink.bridge;
    for (P &p : bridge) {
        if (p.first > p.second) swap(p.first, p.second);
    }

    sort(bridge.begin(), bridge.end());
    for (P p : bridge) cout << p.first << " " << p.second << '\n';
}

int main() {
    // AOJ_GRL_3_A();
    AOJ_GRL_3_B();
    return 0;
}


Measured memory_bytes: 5252
/*
	Author: Hamza Hasbi
	Copyrights: "h.hamza" ==> "www.hamzahasbi.me"
	Date: 10/06/2017 13:15:28
*/
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define uld unsigned long double
#define ui unsigned int
#define ud unsigned double
#define uf unsigned float
#define pi 2*acos(0.0)
#define module cin.ignore()
#define rep(i,l,r) for(auto i=l;i<=r;i++)
#define range(x,y) for(auto x:y)
//inline lcm(int a,int b) {return a*b/__gcd(a,b);}
//inline gcd(ll a,ll b) {return 1LL*b == 0 ? a : gcd(1LL*b, a*1LL % b*1LL);}
using namespace std;

main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	string s;
	cin>>s;
	int totl = 0, totr = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '(') totl++;
		else
		{
			if (totl > 0) totl--;
			else totr++;
		}
	}
	for (int i = 0; i < totl; i++) s = s + ')';
	for (int i = 0; i < totr; i++) s = '(' + s;
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 256
def main():
    a, b = map(int, input().split())
    if a == b:
        print("Draw")
    elif a == 1:
        print("Alice")
    elif b == 1:
        print("Bob")
    elif a > b:
        print("Alice")
    else:
        print("Bob")


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
def read_input():
    n, m = map(int, input().split())

    alist = []
    for i in range(n):
        alist.append(input().strip())

    blist = []
    for i in range(m):
        blist.append(input().strip())

    return n, m, alist, blist




def submit():
    n, m, alist, blist = read_input()

    for i in range(n - m + 1):
        for j in range(n - m + 1):

            check = True
            for x in range(m):
                for y in range(m):
                    if alist[i + x][j + y] != blist[x][y]:
                        check = False
                        break
                if not check:
                    break

            if check:
                print('Yes')
                return

    print('No')


if __name__ == '__main__':
    submit()


Measured memory_bytes: 38256
/**
 *    author        : Saurav Paul 
 *    created       : August 24, 2020 11:46 AM
 *    Problem Name  : D - Wizard in Maze
 *    Problem Limit : 2000 ms , 1024 MB
 *    Problem Url   : https://atcoder.jp/contests/abc176/tasks/abc176_d
 *    @genarated by : ai-virtual-assistant
**/

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

const int nax = 1e3 + 10 ;
const int INF = 1e9 + 90 ;
int H , W ;
int sx , sy , fx , fy ;
char grid[nax][nax] ;
int dist[nax][nax] ;
int dx[] = {-1,1,0,0} ;
int dy[] = {0,0,-1,1} ;

class Prop{
    public :
        int x , y , cost ;
        Prop(){
            x = y = cost = 0 ;
        }
        void update(int a, int b,int c){
            x = a , y = b , cost = c ;
        }
}temp,curr;

class Compare{
    public :
        bool operator()(Prop a , Prop b){
            return a.cost > b.cost ;
        }

};
bool legal(int x , int y){
    if(x < 0 || x >= H || y < 0 || y >= W || grid[x][y] =='#') return false ;
    return true ;
}

void solve(){

    scanf("%d%d",&H,&W) ;
    scanf("%d%d%d%d",&sx,&sy,&fx,&fy) ;
    sx -- ; sy-- ; fx-- ; fy-- ;

    for(int i = 0 ; i < H ; i++){
        scanf("%s",grid[i]) ;
    }

    priority_queue<Prop,vector<Prop>,Compare> PQ ;
    temp.update(sx,sy,0) ;
    PQ.push(temp) ;

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

    dist[sx][sy] = 0 ;
    while(!PQ.empty()){
        curr = PQ.top() ;
        PQ.pop() ;
        int x = curr.x ;
        int y = curr.y ;
        int cost = curr.cost ;

        for(int d = 0 ; d < 4 ; d++){
            int nx = x + dx[d] ;
            int ny = y + dy[d] ;

            if(!legal(nx,ny)) continue ;

            if(dist[nx][ny] > dist[x][y]){
                dist[nx][ny] = dist[x][y] ;
                temp.update(nx,ny,dist[nx][ny]) ;
                PQ.push(temp) ;
            }
        }

        for(int nx = x - 2 ; nx <= x + 2 ; nx ++){
            for(int ny = y - 2 ; ny <= y + 2 ; ny ++){
                if(!legal(nx,ny)) continue ;
                if(dist[nx][ny] > dist[x][y] + 1){
                    dist[nx][ny] = dist[x][y] + 1 ;
                    temp.update(nx,ny,dist[nx][ny]) ;
                    PQ.push(temp) ;
                }
            }
        }
    }
    if(dist[fx][fy] == INF) puts("-1") ;
    else printf("%d\n",dist[fx][fy]) ;

}

int main(){

    int testcases = 1;
    for(int i = 1 ; i <= testcases ; i ++){
        solve();
    }

    return 0 ;
}


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

int main(void)
{
    int a, b, c;
    cin >> a >> b >> c;
    int res = 0;
    for (int i = a; i <= b; i++) {
        if (c % i == 0) {
            res++;
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 3092