akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(){
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	while(a&&c){
		c=c-b;
		if(c<=0) break;
		a=a-d;
		if(a<=0) break;
	}
	if(c<=0) printf("Yes\n");
	if(a<=0) printf("No\n");
}

Measured memory_bytes: 1608
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int solve(){
  int n;
  cin >> n;
  vector<int>v(n),c(n);
  rep(i,n)cin >> v[i];
  rep(i,n)cin >> c[i];
  int ans = 0;
  rep(i,n)if(v[i] > c[i])ans += v[i] - c[i];
  cout << ans << endl;
  return 0;
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  // cout << fixed;cout << setprecision(16) << endl; 
  solve();
  return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>

using namespace std;

#define all(c) c.begin(),c.end()
#define repeat(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define debug(x) #x << "=" << (x)
#define dump(x) cerr << debug(x) << " (L:" << __LINE__ << ")"<< endl

typedef long long ll;
typedef vector<int> vi;

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec){
    os << "[";
    for(int i = 0; i < vec.size(); i++){
        os << vec[i] << ",";
    }
    os << "]";
    return os;
}

template<typename T>
T input(){
    T t;
    cin >> t;
    return t;
}

template<typename T>
vector<T> input(const int N){
    vector<T> v(N);
    repeat(i,N) cin >> v[i];
    return v;
}

long long gcd(long long a, long long b){
    if(b == 0){
        return a;
    }
    return gcd(b, a % b);
}

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

vector<ll> LucaSequence(100, -1);

ll calcLuca(ll N) {
    if (N == 0) {
        return 2;
    }
    if (N == 1) {
        return 1;
    }
    if (LucaSequence[N] != -1) {
        return LucaSequence[N];
    }
    ll answer = calcLuca(N - 1) + calcLuca(N - 2);
    LucaSequence[N] = answer;
    return answer;
}

int main(){
    ll N;
    cin >> N;
    cout << calcLuca(N) << endl;
    return 0;
}


Measured memory_bytes: 384
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int i, count = 0;
    String str_a = sc.next();
    String str_b = sc.next();
    for(i = 0; i < str_a.length(); i++) {
      if(str_a.charAt(i) == str_b.charAt(i)) count++;
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 22612
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FASTIO cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define loop(i,a,b) for(int i=a; i<b; i++)
#define INF 10000000000099ll
#define mod 1000000007

int solve(vector<int> arr, int n)
{
    vector<int> dp(n+1);
    dp[1]=0;
    dp[2]= abs(arr[2]-arr[1]);
    for(int i=3; i<=n; i++){
        int a= abs(arr[i]-arr[i-1])+dp[i-1];
        int b= abs(arr[i]-arr[i-2])+dp[i-2];
        dp[i]= min(a,b);
    }
    return dp[n];
}

int main()
{
    FASTIO;
    int n;
    cin>>n;
    vector<int> arr(n+1);
    for(int i=1; i<=n; i++) cin>>arr[i];
    cout<<solve(arr, n);
    return 0;
}




Measured memory_bytes: 4500
#include<stdio.h>
#include<vector>
#include<string>
#include<iostream>
using namespace std;

int main(){
 int x[5];
 cin >> x[0] >> x[1] >> x[2] >> x[3] >> x[4];
 //cout << x[4] << endl;
int res = 1000;
int buf[5];
 for(int a = 0; a < 5; a++){
   if(x[a]%10 == 0)  buf[0] = ((x[a]/10))*10;
   else buf[0] = ((x[a]/10)+1)*10;
      //cout << "a" << buf << endl;
    //cout << buf << endl;
    for(int b = 0; b < 5; b++){
      if(a != b){
        if(x[b]%10 == 0)  buf[1] = (((buf[0]+x[b])/10))*10;  
        else buf[1] = (((buf[0]+x[b])/10)+1)*10;  
        //cout << buf << endl;
          for(int c = 0; c < 5; c++){
            if(c != a && c != b){
                if(x[c]%10 == 0)  buf[2] = (((buf[1]+x[c])/10))*10;  
                else buf[2] = (((buf[1]+x[c])/10)+1)*10;  
                  for(int d = 0; d < 5; d++){
                        if(d != a && d != b && d != c){
                            if(x[d]%10 == 0)  buf[3] = (((buf[2]+x[d])/10))*10;  
                            else buf[3] = (((buf[2]+x[d])/10)+1)*10; 
                                for(int e = 0; e < 5; e++){
                                    if(e != a && e != b && e != c && e != d){
                                              buf[4] = buf[3] + x[e];
                                              if(buf[4] < res) res = buf[4];
                                              //cout << a << " " << b << " " << c << " "<< d << " " <<  e << " " << res << endl;
                          }
              }             
            }
   
 }
   
 }}
      } 
 }

 }
 cout << res << endl;
}

Measured memory_bytes: 256
while num_s = gets
	num = num_s.to_i
	if num == 0
		break
	end
	num.times do
		score = Array.new(3)
		score = gets.split(nil)
		if score[0].to_i == 100 || score[1].to_i == 100 || score[2].to_i == 100
			puts "A"
		elsif (score[0].to_i + score[1].to_i) / 2 >= 90
			puts "A"
		elsif (score[0].to_i + score[1].to_i + score[2].to_i) / 3 >= 80
			puts "A"
		elsif (score[0].to_i + score[1].to_i + score[2].to_i) / 3 >= 70
			puts "B"
		elsif (score[0].to_i + score[1].to_i + score[2].to_i) / 3 >= 50 && (score[0].to_i >= 80 || score[1].to_i >= 80)
			puts "B"
		else
			puts "C"
		end
		
	end
end

Measured memory_bytes: 8696
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MAXX 100005
#define PI 3.14159265358979323846264338327950
#define ll signed long long int
using namespace std;
ll t , n, k,  x = 0, y = 2, m, ans = 0,h,s ;
ll a[MAXX], b[MAXX], c[MAXX];
double f = 0.5;
vector<ll> adj[MAXX];
bool used[MAXX];
ll d[MAXX];
ll p[MAXX];
queue<ll> q;

signed main()
{
	FAST;
	cin >> n;
	string str;
	cin >> str;
	if(n >= 3200){
		cout << str;
		return 0;
	}
	cout << "red";
}

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

int main(){
  int n;
  string a,b;
  cin>>n>>a>>b;
  int kotae=0;
  for(int i=a.size();i>=0;i--){
    string s,t;
    s=a.substr(a.size()-i,i);
    t=b.substr(0,i);
      if(s==t){
        kotae=a.size()+b.size()-i;
        break;
      }
  }
  cout<<kotae<<endl;
  return 0;
}

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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}






int gcd(int a,int b)
{
 
  int r, tmp;
 
  
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
 
 
  return b;
}







int fac(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  string a,b,c;
  bool flaga=false;
  bool flagb=false;
  bool flagc=false;
  char cnt,ans;
  cin>>a>>b>>c;
  reverse(a.begin(),a.end());
  reverse(b.begin(),b.end());
  reverse(c.begin(),c.end());
  cnt=a[a.size()-1];
  while(true){
    
    if(cnt=='a' && flaga){
      ans='A';
      break;
    }else if(cnt=='a'){
      cnt=a[a.size()-1];
      a.pop_back();
    }
    
    if(cnt=='b' && flagb){
      ans='B';
      break;
    }else if(cnt=='b'){
      cnt=b[b.size()-1];
      b.pop_back();
    }
    
    if(cnt=='c' && flagc){
      ans='C';
      break;
    }else if(cnt=='c'){
      cnt=c[c.size()-1];
      c.pop_back();
    }
    
    if(a.size()==0){
      flaga=true;
    }
    
    if(b.size()==0){
      flagb=true;
    }
    
    if(c.size()==0){
      flagc=true;
    }
  }
  cout<<ans<<endl;
  
}
///////////////////////////





Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] ints = new int[2];

		do {
			for(int i = 0; i < 2; i++) {
				ints[i] = sc.nextInt();
			}

			if (ints[0] == 0 && ints[1] == 0) {
				break;
			}

			for (int i = 0; i < ints[0]; i++) {
				for (int j = 0; j < ints[1]; j++) {
					System.out.print("#");
				}
				System.out.println();
			}

			System.out.println();

		}while(true);

		sc.close();
	}

}


Measured memory_bytes: 34384
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int a, b;
	cin >> a >> b;
	if (a & b & 1) puts("Odd");
	else puts("Even");
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

// std::ios::sync_with_stdio(false);

// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

int main()
{
    /* #ifndef ONLINE_JUDGE */
    /*     freopen("foo", "rt", stdin); */
    /* #endif */
    int N;
    while (cin >> N) {
        map<int,int> seq;
        FOR(i,0,N) {
            int x; cin >> x;
            seq[x]++;
        }
        int ans = 1;
        FOR_ALL(i,seq) {
            const int X = i->first;
            int res = i->second;
            auto j = i; 
            if (j != seq.begin()) {
                --j;
                const int xx = X - (j->first);
                if (xx <= 1)
                    res += j->second;
                ++j;
            }
            ++j;
            if (j != seq.end()) {
                const int xx = (j->first) - X;
                if (xx <= 1)
                    res += j->second;
            }
            ans = max(ans,res);
        }
        cout << ans << endl;
    }
    return 0;
}


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

#define R register
#define maxn 100010
int a[maxn]; bool vis[maxn];
int main()
{
	R int n; scanf("%d", &n);
	for (R int i = 1; i <= n; ++i) scanf("%d", &a[i]);
	n = std::unique(a + 1, a + n + 1) - a - 1;
	R int ans = 1;
	for (R int i = 2; i < n; ++i)
		if (!vis[i - 1] && ((a[i] < a[i - 1] && a[i] < a[i + 1]) || (a[i] > a[i - 1] && a[i] > a[i + 1]))) ++ans, vis[i] = 1;
	printf("%d\n", ans);
	return 0;
}
/*
10
1 2 1 2 1 2 1 2 1 1
*/

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

#define N 8
#define FREE -1
#define NOT_FREE 1

int row[N], col[N], dpos[2 * N - 1], dneg[2 * N - 1];

bool X[N][N];

void initialize()
{
  for (int i = 0; i < N; i++)
  {
    row[i] = FREE;
    col[i] = FREE;
  }
  for (int i = 0; i < 2 * N - 1; i++)
  {
    dpos[i] = FREE;
    dneg[i] = FREE;
  }
}

void printBoard()
{
  for (int i = 0; i < N; i++)
  {
    for (int j = 0; j < N; j++)
    {
      if (X[i][j])
      {
        if (row[i] != j)
        {
          return;
        }
      }
    }
  }
  for (int i = 0; i < N; i++)
  {
    for (int j = 0; j < N; j++)
    {
      cout << ((row[i] == j) ? "Q" : ".");
    }
    cout << endl;
  }
}

void recursive(int i)
{
  if (i == N)
  {
    printBoard();
    return;
  }

  for (int j = 0; j < N; j++)
  {
    if (NOT_FREE == col[j] ||
        NOT_FREE == dpos[i + j] ||
        NOT_FREE == dneg[i - j + N - 1])
    {
      continue;
    }
    row[i] = j;
    col[j] = dpos[i + j] = dneg[i - j + N - 1] = NOT_FREE;
    recursive(i + 1);
    row[i] = col[j] = dpos[i + j] = dneg[i - j + N - 1] = FREE;
  }
}

int main()
{
  initialize();

  for (int i = 0; i < N; i++)
  {
    for (int j = 0; j < N; j++)
    {
      X[i][j] = false;
    }
  }

  int k;
  cin >> k;
  for (int i = 0; i < k; i++)
  {
    int r, c;
    cin >> r >> c;
    X[r][c] = true;
  }

  recursive(0);

  return 0;
}


Measured memory_bytes: 3112
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// head

int n,k,g[101000];
int main() {
	scanf("%d%d",&n,&k);
	rep(i,0,n) scanf("%d",g+i);
	sort(g,g+n);
	if (g[0]==g[n-1]) {
		puts(g[0]==k?"POSSIBLE":"IMPOSSIBLE");
		return 0;
	}
	int d=g[n-1]-g[0];
	rep(i,0,n-1) if (g[n-1]!=g[i]) d=__gcd(d,g[n-1]-g[i]);
	if (k<=g[n-1]&&(g[n-1]-k)%d==0) puts("POSSIBLE");
	else puts("IMPOSSIBLE");
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define lp(i, x, n) for (int i = x; i < (int)n; i++)
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define ll long long
#define N 100011
int main() {
        string str;
        cin >> str;
        if (sz(str) == 2) cout << str;
        else {
                reverse(all(str));
                cout << str;
        }
        return 0;
}


Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
while(true){
   var t=Arr.shift()-0;
   if(t==0)break;
   var n=Arr.shift()-0;
   var sum=0;
   for(var i=0;i<n;i++){
      var arr=(Arr.shift()).split(" ").map(Number);
      sum+=arr[1]-arr[0];
   }
   console.log((t<=sum)?"OK":t-sum);
}

Measured memory_bytes: 9436
def plus(s):
   s=s.replace("#","")
   if "+" in s:
      numbers=list(map(int,s.split("+")))
      return sum(numbers) 

   else:
      return int(s)

S=input()
N=len(S)-1  #+が入りうる箇所

#数字の間に#を挿入
S_re=[]
for i in range(len(S)):
   if i!=len(S)-1:
      S_re.append(S[i])
      S_re.append("#")
   else:
      S_re+=S[i]
T="".join(S_re)

#bit全探索
count=0
for i in range(1<<N):
   output=[]
   for j in range(N):
      if((i>>j) & 1)==1:
         output.append(j)

   S_re=[c for c in T]
   for k in output:
      L=2*k+1
      S_re[L]="+"
   mojiretsu="".join(S_re)
   count+=plus(mojiretsu)

print(count)

Measured memory_bytes: 3064
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <cmath>
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;

int main(){
  char str;
  cin >> str;
  if(str >= 'A' && str <= 'Z'){
    cout << "A" << endl;
  }else if(str >= 'a' && str <= 'z'){
    cout << "a" << endl;
  }
}


Measured memory_bytes: 3616
list=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]
for i in range(28):
    lists=int(input())
    list.remove(lists)
print(list[0])
print(list[1])


Measured memory_bytes: 5600
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(int i=(s);i<(t);++i)
#define per(i,s,t) for(int i=((t)-1);i>=s;--i)
#define repb(i,s,t) for(int i=(s);i<=(t);++i)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)x.size())
#define mst(a,b) memset(a,b,sizeof(a))
#define mcpy(des,sor) memcpy(des,sor,sizeof(sor))
#define dd(x) cout<<#x<<'='<<x<<' '
#define de(x) cout<<#x<<'='<<x<<'\n'
#define fi first
#define se second
#define sq(x) ((x)*(x))
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;

const int inf = 0x3f3f3f3f;
const ll mod = 1e9+7;
const db eps = 1e-8;

char io[1<<15],*is=io,*ie=io+1;
#define rd if(++is==ie)ie=(is=io)+fread(io,1,sizeof(io),stdin)
template<class T>
inline bool Cin(T &a){
	a=0;bool s=0;
	if(is==ie)return 0;
	do{rd;if(*is=='-')s=1;}while(!isdigit(*is)&&is!=ie);
	if(is==ie)return 0;
	do{(a*=10)+=*is&15;rd;}while(isdigit(*is)&&is!=ie);
	if(s)a=-a;;return 1;}

inline int Gets(char a[]){
	int p=0;
	if(is==ie)return 0;
	do rd; while(!isgraph(*is)&&is!=ie);
	if(is==ie)return 0;
	do {a[p++]=*is;rd;}while(isgraph(*is)&&is!=ie);
	a[p]=0;return p;}

#define maxn 200005
char s[maxn];
set<int> N[maxn],G[maxn];
queue<int> q;

int main()
{
	int n,m,a,b;
	Cin(n);Cin(m);
	Gets(s+1);
	rep(i,0,m)
	{
		Cin(a),Cin(b);
		if(s[a]==s[b])
			N[a].insert(b),N[b].insert(a);
		else 
			G[a].insert(b),G[b].insert(a);
	}
	repb(i,1,n)if(!sz(N[i])||!sz(G[i]))q.push(i);
	while(!q.empty())
	{
		a=q.front();q.pop();
		for(auto b:N[a])
		{
			N[b].erase(a);
			if(!sz(N[b]))q.push(b);
		}
		for(auto b:G[a])
		{
			G[b].erase(a);
			if(!sz(G[b]))q.push(b);
		}
	}
	repb(i,1,n)if(sz(G[i])&&sz(N[i]))return !printf("Yes\n");
	printf("No\n");
}

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


int main(){
	int h,w;
	cin>>h>>w;
	vector<int>a;
	vector<int>b(w);
	vector<int>res;

	rep(i,h){
		rep(j,w)cin>>b[j];
		if(i%2==1)reverse(b.begin(),b.end());
		a.insert(a.end(),b.begin(),b.end());
	}

	rep(i,h*w-1){
		if(a[i]%2==1){
			a[i+1]++;
			res.push_back(i);
		}
	}

	cout<<res.size()<<endl;

	rep(i,res.size()){
		int t=res[i]/w;
		if(t%2==0){
			if((res[i]+1)%w==0){
				cout<<t+1<<' '<<w<<' '<<t+2<<' '<<w<<endl;
			}
			else{
				cout<<t+1<<' '<<res[i]%w+1<<' '<<t+1<<' '<<res[i]%w+2<<endl;
			}
		}
		else{
			if((res[i]+1)%w==0){
				cout<<t+1<<' '<<1<<' '<<t+2<<' '<<1<<endl;
			}
			else{
				cout<<t+1<<' '<<w-res[i]%w<<' '<<t+1<<' '<<w-res[i]%w-1<<endl;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 4116
using System;
using System.Collections.Generic;
using System.Linq;
public class GFG
{
    
    public static void Main()
    {
        var arr = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

        for(int i=0;i<arr.Length;i++)
        {
            if(arr[i]==0)
            {
                Console.WriteLine(i+1);
                break;
            }
        }
    }

   
}


Measured memory_bytes: 19076
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int t = 1;
        Solver s = new Solver();
        for (int i = 1; i <= t; i++) {
            s.solve(i, in, out);
        }
        out.close();
    }

}

class Solver {

    void solve(int test, InputReader in, PrintWriter out) throws IOException {
        int n = in.nextInt();
        HashMap<Integer, Integer> map = new HashMap<>();
        int ans = 0;
        for (int i = 0; i < n; i++) {
            int x = in.nextInt();
            if (map.containsKey(x)) {
                map.put(x, map.get(x) + 1);
            } else {
                map.put(x, 1);
            }
        }
        for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
            int x = entry.getKey();
            int cnt = entry.getValue();
            if (x == cnt) continue;
            if (x > cnt) ans += cnt;
            else ans += cnt - x;
        }
        out.println(ans);
    }
}

class InputReader {
    BufferedReader br;
    StringTokenizer st;

    public InputReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
        st = null;
    }

    public String next() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return st.nextToken();
    }

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

    public long nextLong() {
        return Long.parseLong(next());
    }

    public String nextLine() throws IOException {
        return br.readLine();
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

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


int main(){
  string s;
  cin >> s;
  int k=s.size();
  int w,l;
  w=0;
  l=0;
  for(int i=0;i<k;++i){
    if(s[i]=='o') w++;
    else l++;
  }
  int n=15-k;
  w+=n;
  
  if(w>=8) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 3572
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::cmp::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    }
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
macro_rules! chmax {
    ($x:expr, $e:expr) => {
        $x = max($x, $e);
    };
}
macro_rules! chmin {
    ($x:expr, $e:expr) => {
        $x = min($x, $e);
    };
}

const INF: i64 = 1 << 60;

fn main() {
    input!{
        mut abc: [usize; 3],
    }
    abc.sort();
    let (a, b, c) = (abc[0], abc[1], abc[2]);
    if (a == b && b != c) || (a != b && b == c) {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

typedef long long ll;
typedef pair<int,int> P;
#define INF 1000000100
#define rep(i,n) for (int i=0;i<n;i++)

int main(){
    int N;
    cin >> N;
    map<string,int> mp;
    mp["AC"] = 0;
    mp["WA"] = 0;
    mp["TLE"] = 0;
    mp["RE"] = 0;
    rep(i,N){
        string S;
        cin >> S;
        mp[S] += 1;
    }
    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;
    return 0;

}

Measured memory_bytes: 3228
#include <iostream>

using namespace std;

int main()
{
    long long int n, w;
    long long int T=0;
    cin >> n >> w;
    int m[n+1], v[n+1];
    for(int i=1; i<=n; i++)
    {
        cin >> m[i] >> v[i];
        T+=v[i];
    }
    long long int f[T];
    f[v[1]]=m[1];
    f[0]=0;
    f[T]=1000000000;
    for(int i=1; i<=T; i++)
    {
        f[i]=1000000000;
    }
    for(int i=1; i<=n; i++)
    {
        for(int t=T; t>=v[i]; t--)
        {
            f[t]=min(m[i]+f[t-v[i]],f[t]);
        }
    }
    for(int i=T; i>=v[1]; i--)
    {
        if(f[i]<=w)
        {
            cout<<i<<endl;
            return 0;
        }
    }
    return 0;
}

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

int main()
{
	int n, m;
	cin >> n >> m;
	vector<vector<long long>> v(m, vector<long long>(2));
	vector<vector<long long>> w(n + 1);
	for (int i = 0; i < m; i++) {
		cin >> v[i][0] >> v[i][1];
		w[v[i][0]].push_back(v[i][1]);
	}
	for (int i = 0; i <= n; i++) {
		sort(w[i].begin(), w[i].end());
	}
	for (int i = 0; i < m; i++) {
		int k = lower_bound(w[v[i][0]].begin(), w[v[i][0]].end(), v[i][1]) - w[v[i][0]].begin() + 1;
		cout << setw(6) << setfill('0') << v[i][0] << setw(6) << setfill('0') << k << endl;
	}
}

Measured memory_bytes: 12416
package main

import "fmt"

type dice struct {
	sur [6]int8
}

func (d *dice) Scan() {
	for i := 0; i < 6; i++ {
		fmt.Scan(&d.sur[i])
	}
	return
}

func (d *dice) Move(dir rune) {
	nd := *d
	switch dir {
	case 'E':
		d.sur[0] = nd.sur[3]
		d.sur[2] = nd.sur[0]
		d.sur[3] = nd.sur[5]
		d.sur[5] = nd.sur[2]
	case 'N':
		d.sur[0] = nd.sur[1]
		d.sur[1] = nd.sur[5]
		d.sur[4] = nd.sur[0]
		d.sur[5] = nd.sur[4]
	case 'S':
		d.sur[0] = nd.sur[4]
		d.sur[1] = nd.sur[0]
		d.sur[4] = nd.sur[5]
		d.sur[5] = nd.sur[1]
	case 'W':
		d.sur[0] = nd.sur[2]
		d.sur[2] = nd.sur[5]
		d.sur[3] = nd.sur[0]
		d.sur[5] = nd.sur[3]
	}
	return
}

func main() {
	d := &dice{}
	d.Scan()
	var op string
	fmt.Scan(&op)
	for _, r := range op {
		d.Move(r)
	}
	fmt.Println(d.sur[0])
	return
}



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

int main(){
    unordered_map<char, char> un_mp;
    char c;
    un_mp['A']='T';
    un_mp['T']='A';
    un_mp['C']='G';
    un_mp['G']='C';
    cin >> c;
    cout << un_mp[c] << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>
using namespace std;
int read(){
	int f=1,x=0;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f*=-1;c=getchar();}
	while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
	return f*x;
}
int a1,a2,a3,a,b,c,sum,maxn=-1;
int main(){
	cin>>a1>>a2>>a3;
	a=abs(a1-a2);b=abs(a1-a3);c=abs(a2-a3);
	sum=a+b+c;
	if(a>maxn)maxn=a;
	if(b>maxn)maxn=b;
	if(c>maxn)maxn=c;
	sum-=maxn;
	cout<<sum;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define loop(n) for (int ngtkana_is_genius = 0; ngtkana_is_genius < int(n); ngtkana_is_genius++)
#define rep(i, begin, end) for(int i = int(begin); i < int(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto& a, auto b){if (a > b) {a = b; return true;} return false;};
auto cmx = [](auto& a, auto b){if (a < b) {a = b; return true;} return false;};
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail){
  std::cerr << " " << head;
  debug_impl(tail...);
}
#ifdef STOPIT
#define debug(...) 0
#else
#define debug(...)\
do {\
  std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
  debug_impl(__VA_ARGS__);\
  std::cerr << std::noboolalpha;\
} while (false)
#endif

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr>
std::istream& operator>> (std::istream& is, Container& v)
  { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr >
std::ostream& operator<< (std::ostream& os, Container const& v) {
 os << "{";
  for (auto it = v.begin(); it != v.end(); it++)
    {os << (it != v.begin() ? "," : "") << *it;}
  return os << "}";
}

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int n; std::cin >> n;
  std::vector< int > a;
  loop(n) {
    int x; std::cin >> x;
    auto lb = std::lower_bound(all(a),x);
    if (lb == a.end()) {
      a.emplace_back(x);
    } else {
      *lb = x;
    }
  }
  // debug(a);
  std::cout << a.size() << std::endl;
  return 0;
}



Measured memory_bytes: 3504
# include <stdio.h>
int main(){
	char o[50],e[50],c=0;
	scanf("%s",o);
	scanf("%s",e);
	while(1){
		if(o[c]==0)break;
		printf("%c",o[c]);
		if(e[c]==0)break;
		printf("%c",e[c]);
		c++;
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
using vs = vector<string>; using tll = tuple<ll, ll, ll>; using vtll = vector<tll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define co(i) cout << i << endl;
#define co2(i,j) cout << i << " " << j << endl;
#define co3(i) cout << i << " ";
#define po(i) cout << i.first << " " << i.second << endl;
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop, bitSearch, bitList, nod, digitDP, treeDP//
//gcdlcm, isPrime, eratos, primeFactorize, Npow, combination, divisor, modinv, doubling//
//dfs, bfs, dijkstra, WarshallFloyd, BellmanFord, UnionFind, Kruskal, RMQ, LCA//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007, INF = 1LL << 60, ans = 0, z = 0, o = 1;
vl flag, D; vll path;
//***********//
int main() {
	ll L, R, D;
	cin >> L >> R >> D;
	for (i = L; i <= R; i++) {
		if (i % D == 0) ans++;
	}
	co(ans);
}

Measured memory_bytes: 3620
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
int main()
{
    long long int side;
    while(scanf("%lld",&side)!=EOF)
    {
        double angle=(180.0-(360.0/(1.0*side)))*side;
        printf("%0.0lf\n",angle);
    }
    return 0;
}

Measured memory_bytes: 128
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 = new int[3];
		for (int i = 0; i < 3; i++) {
			n[i] = sc.nextInt();
		}
		sc.close();
		Arrays.sort(n);
		System.out.println((n[2] * 10) + n[1] + n[0]);
	}
}


Measured memory_bytes: 21716
#include<iostream>
using namespace std;
int main(){
  	int su=0;
  	string s,t;
  	cin>>s>>t;
  	for(int i=0;i<3;i++){
    	if(s[i]==t[i])
          	su++;
    }
  	cout<<su<<endl;
	return 0;
}

Measured memory_bytes: 256
/*
	Created by : imay_10
	" It won't be EASY, but I'll make it "
*/

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

typedef long long int ll;
const int mod = 1e9+7;
const ll inf = 1e18;
const double pi = 3.1415926535897932384626;

// Utility for fast exponentiation
ll mpow(ll a,ll b,ll m){
    ll res=1;
    //a%=m;
    while(b){
    	if(b%2) res=res*a%m;
		a=a*a%m;
		b/=2;
	}
	return res;
}

// Utility for GCD Calculation
ll gcd(ll a,ll b){
	if(b==0) return a;
	return gcd(b,a%b);
}

void solve(){
	//code
	char c;
	cin>>c;
	cout<<char(c+1);
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	solve();
 	return 0;
}


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

int main(){
    int n, i;
    cin >> n;
    int d[n];
    for(i=0; i<n; i++){
        cin >> d[i];
    }
    sort(d, d+n);
    cout << d[n/2] - d[n/2-1];
    return 0;
}

Measured memory_bytes: 768
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int h1 = sc.nextInt();
        int m1 = sc.nextInt();
		int h2 = sc.nextInt();
        int m2 = sc.nextInt();
		int k = sc.nextInt();
        int ans = 0;
        ans = 60 * (h2 - h1) + (m2 - m1) - k;
      	System.out.println(ans);

    }
}

Measured memory_bytes: 35840
#define scanf_s scanf
//#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 1000
#define MIN 2
int main(void)
{
	int n, m;
	while (scanf_s("%d %d",&n,&m) != EOF) {
		if (n == 0 && m == 0) break;
		int h[MAX + 1] = { 0 },ans = 0, cou = 0, k = 0;
		while(cou < n) {
			for (int i = ans + 1; k <= m; ++i) {
				if (i > n) { i = i - n; }
				if (h[i] == false) { ++k; }
				if (k >= m) {
					k = 0; ++cou;
					h[i] = true;
					ans = i;
					break;
				}
			}
		}
		printf("%d\n", ans);
	}
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1000000007;
const double PI = acos(-1);

int main()
{
	int h, w, k;
	cin >> h >> w >> k;
	int black = 0;
	vector<vector<char>> c(h, vector<char>(w));
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> c[i][j];
			if (c[i][j] == '#') black++;
		}
	}

	int ans = 0;
	for (int bit = 0; bit < 1 << (h + w); bit++) {
		vector<int> height(h);
		vector<int> width(w);
		for (int i = 0; i < (h + w); i++) {
			if (1 & (bit >> i)) {
				if (i <= h - 1) height[i] = 1;
				else width[i - h] = 1;
			}
		}
		int black_count = black;
		vector<vector<char>> tmp(c);
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (height[i]) {
					if (tmp[i][j] == '#') {
						black_count--;
						tmp[i][j] = '+';
					}
				}
			}
		}
		for (int j = 0; j < w; j++) {
			for (int i = 0; i < h; i++) {
				if (width[j]) {
					if (tmp[i][j] == '#') {
						black_count--;
						tmp[i][j] = '+';
					}
				}
			}
		}
		if (black_count == k) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
	int k;
	cin>>k>>s;
	int b=s.size();
	if(b>k){
		string a=s.substr(0,k);
		cout<<a;
		cout<<"...";
		return 0;
		
	}
	else{
		cout<<s;
		return 0;
	}
} 


Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <bitset>
#include <unordered_map>
#include <queue>
#include <stack>

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, s, n) for (int i = (int)(s); i < (int)(n); i++)

typedef long long ll;

int main(){
    int n;
    ll ans = 0;
    cin >> n;
    int sticks[n];
    rep(i,n){
        cin >> sticks[i];
    }
    sort(sticks, sticks+n);

    rep(i,n-2){
        repn(j,i+1,n-1){

            int target = sticks[i] + sticks[j];
            int index = lower_bound(sticks, sticks+n, target) - sticks;

            // Didn't find any triangle
            if( index == j ){
                continue;
            }
            // Find triangle.
            ans += index - j - 1;
        }
    }

    cout << ans << endl;
}

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

int main()
{
    int n;
    cin >> n;
    vector<int> t(n), v(n);
    rep(i, 0, n) cin >> t[i];
    rep(i, 0, n) cin >> v[i];

    vector<double> velocity;
    velocity.push_back(0);
    rep(i, 0, n)
    rep(j, 0, t[i] * 2)
    {
        velocity.push_back(v[i]);
        if (i > 0 and j == 0)
            velocity[velocity.size() - 2] = 
                min(velocity[velocity.size() - 2], velocity[velocity.size() - 1]);  
    }

    int total = 0;
    rep(i, 0, n) total += t[i];

    velocity[0] = 0;
    rep(i, 0, total * 2)
        velocity[i + 1] = min(velocity[i] + 0.5, velocity[i + 1]);
    
    velocity[2 * total] = 0;
    rrep(i, 2 * total, 0)
        velocity[i] = min(velocity[i + 1] + 0.5, velocity[i]);

    double ans = 0;
    double cnt = 0;
    rep(i, 1, 2 * total + 1)
    {
        // cout <<(double)i /2 << ' ' <<  velocity[i] <<  endl;
        if (velocity[i - 1] != velocity[i]) ++cnt;
        ans += 0.5 * min(velocity[i - 1], velocity[i]);
    }
    ans +=  cnt * 0.5 * 0.5 * 0.5;

    printf("%.5lf\n", ans);
    return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 0; i < n; ++i)
#define rep3(i, a, b) for (ll i = a; i < b; ++i)
#define rep4(i, a, b, c) for (ll i = a; i < b; i += c)
#define erep(n) for (ll i = 0; i <= n; ++i)
#define erep2(i, n) for (ll i = 0; i <= n; ++i)
#define erep3(i, a, b) for (ll i = a; i <= b; ++i)
#define erep4(i, a, b, c) for (ll i = a; i <= b; i += c)
#define rrep(i, a, b) for (ll i = a; i > b; --i)
#define rrep2(i, a, b, c) for (ll i = a; i > b; i -= c)
#define errep(i, a, b) for (ll i = a; i >= b; --i)
#define errep2(i, a, b, c) for (ll i = a; i >= b; i -= c)
#define print(a) cout << a << endl;
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define cin(x) cin >> x;
const ll MOD = 1000000007;
const double PI = 3.14159265358979323846264338327950;
inline int newline() { putchar('\n'); return 0; }

struct DirectedGraph {
    private:
        // 有向グラフの隣接リスト
        const vector<vector<ll>> to;
        // 各頂点の入次数
        vector<ll> indegrees;

    public:
        DirectedGraph(vector<vector<ll>> to): to(to), indegrees(to.size(), 0) {
            for (vector<ll> i: to) {
                for (ll j: i) {
                    ++indegrees[j];
                }
            }
        }

        vector<ll> topologicalSort() {
            // 入次数が 0 の頂点の集合
            stack<ll> s;

            for (ll i = 0; i < to.size(); ++i) {
                if (indegrees[i] == 0) s.push(i);
            }

            vector<ll> sorted;

            while(s.size() > 0) {
                ll top = s.top(); s.pop();
                sorted.push_back(top);

                for (ll i: to[top]) {
                --indegrees[i];
                if (indegrees[i] == 0) s.push(i);
                }
            }
            return sorted;
        }
};

int main() {
    ll n, m;
    cin(n); cin(m);

    vector<vector<ll>> to(n);

    rep2(i, m) {
        ll x, y;
        cin(x); cin(y);
        --x; --y;

        to[x].push_back(y);
    }

    DirectedGraph dg(to);
    vector<ll> sorted = dg.topologicalSort();

    vector<ll> dp(n, 0);
    ll result = 0;

    for (ll i: sorted) {
        for (ll j: to[i]) {
            ll v = dp[i] + 1;
            if (v > dp[j]) {
                dp[j] = v;
                if (v > result) result = v;
            }
        }
    }

    print(result);
    return 0;
}

Measured memory_bytes: 17408
#include <bits/stdc++.h>
#define INF 1e18
#define PI M_PI
#define ll long long
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define REP(i, n) for (int i=0; i<n; i++)
#define REPD(i, n) for (int i=n-1; i>=0; i--)
#define print(x) cout << x << endl;
#define debug(x) cout << #x << " = " << endl;

using namespace std;

void solve()
{
    int N;
    cin >> N;
    int ans = 0;
    for (int i=1; i<=N; i++) {
        if (i<10) {
            ans += 1;
        } else if ((to_string(i)).length() % 2 != 0) {
            ans += 1;
        }
    }
    print(ans);
}

int main()
{
    solve();

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define ALL(a) (a).begin(),(a).end()
#define EACH(e,v) for(auto& e:v)
#define SORT(v) sort(ALL(v))
#define PERM(v) SORT(v);for(bool c##p=1;c##p;c##p=next_permutation(ALL(v)))
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <class T> void chmax(T & a, T const & b) { if (b > a) a = b; }
template <typename T>
string to_string(const T &n){ostringstream stm;stm << n;return stm.str();}
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = 1000'000'007;
 
signed main(){
    string s;
    cin>>s;
    for(int i=0;i<s.size()-1;i++){
        if(s[i]==s[i+1]){
            cout<<"Bad"<<endl;
            return 0;
        }
    }
    cout<<"Good"<<endl;
 
}

Measured memory_bytes: 384
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc =new Scanner(System.in);
		
		int A = sc.nextInt();
		int B = sc.nextInt();
		int T = sc.nextInt();
		int ans = 0;
		for (int i = 1; i < T + 0.5; i++) {
			if (i % A == 0) {
				ans += B;
			}
		}
		
		System.out.println(ans);
		sc.close();
	}

}


Measured memory_bytes: 27004
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
long long rui(long long n, long long k, long long p) {
	if (k == 0) {
		return 1;
	}
	else {
		long long a = rui(n, k / 2, p);
		if (k % 2 == 0) {
			return (a*a) % p;
		}
		return (((a*a) % p)*n) % p;
	}
}
int main(){
	long long h, w;
	cin >> h >> w;
	long long ans = 0;
	for (long long i = 1; i <= h; i++) {
		for (long long j = 1; j <= w; j++) {
			long long a;
			cin >> a;
			ans += a * i*(h - i + 1)*j*(w - j + 1);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i,a) for(int i=0;i<(a);i++)
#define MOD 1000000007

int main(){
  int N; cin>>N;
  map<string,int> mp1,mp2;
  rep(i,N){
    string s;cin>>s;
    mp1[s]++;
  }
  int M; cin>>M;
  rep(i,M){
    string s; cin>>s;
    mp2[s]++;
  }
  int ans=0;
  for(auto mp:mp1){
    string s=mp.first;
    int n=mp.second;
    ans=max(ans,n-mp2[s]);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
n=gets.to_i
l=[]
n.times do |i|
  a,b=gets.split.map(&:to_i)
  l << [a+b,a,b]
end
l.sort!.reverse!
c=0
n.times do |i|
  if i.even?
    c+=l[i][1]
  else
    c-=l[i][2]
  end
end
puts c

Measured memory_bytes: 10488
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
using namespace std;
int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
		if(a+b >= 10) printf("error\n");
		else printf("%d\n",a+b);
	
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        List<Integer> a = new ArrayList<>();
        for(int i = 0;i < 3;i++){
            a.add(sc.nextInt());
        }
        Collections.sort(a);
        int ans = Math.abs(a.get(0) - a.get(1)) + Math.abs(a.get(2) - a.get(1));
        System.out.println(ans);
    }
}


Measured memory_bytes: 21844
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.Set;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;

import static java.util.Comparator.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    }
}
class Solver {
	Scanner sc;
	PrintWriter out;
    public Solver(InputStream in, PrintWriter out) {
    	sc = new Scanner(in);
    	this.out = out;
    }
    // ==================================================================
    long MOD = 1000000007;
    int[][] D = new int[60][3 * 100000];		// 60桁分の累積和
    public void solve() {
    	int N = Integer.parseInt(sc.next());
    	long[] A = new long[N];
    	for (int j = 0; j < N; j++) {
        	A[j] = Long.parseLong(sc.next());
        	for (int i = 0; i < 60; i++) {
        		if(j == 0)	D[i][j] = (int)((A[j] >> i) & 1); 
        		else		D[i][j] = D[i][j-1] + (int)((A[j] >> i) & 1); 
//        		out.println("D[" + i + "][" + j + "] = " + D[i][j]);
			}
		}
    	long ans = 0;
    	long wk1, wk2;
    	for (int i = 0; i < 60; i++) {
			wk1 = (1L << i) % MOD;
//			out.println("ビット　" + i + " を処理する　   2 ^ " + i + " = " + wk1);
			for (int j = 0; j < N - 1; j++) {
				wk2 = D[i][N-1] - D[i][j];
				if(((A[j] >> i) & 1) == 0) {
					ans += ((wk1 * wk2) % MOD);
//					out.println("　　先頭　 " + j + "は　０　　" + j + "より後ろの　１　の数　＝　" + wk2 + "  --> ans = " + ans);
				} else {
					ans += ((wk1 * (long)(N - (j+1) - wk2)) % MOD);
//					out.println("　　先頭　 " + j + "は　１　　" + j + "より後ろの　０　の数　＝　" + (N - (j+1) - wk2) + "  --> ans = " + ans);
				}
				ans %= MOD;
			}
		}
    	out.println(ans);
    }    
    // ==================================================================
}



Measured memory_bytes: 170500